
bin/kernel:     file format elf32-i386


Disassembly of section .text:

c0100000 <kern_entry>:
.text
.globl kern_entry
kern_entry:
    # reload temperate gdt (second time) to remap all physical memory
    # virtual_addr 0~4G=linear_addr&physical_addr -KERNBASE~4G-KERNBASE 
    lgdt REALLOC(__gdtdesc)
c0100000:	0f 01 15 18 70 12 00 	lgdtl  0x127018
    movl $KERNEL_DS, %eax
c0100007:	b8 10 00 00 00       	mov    $0x10,%eax
    movw %ax, %ds
c010000c:	8e d8                	mov    %eax,%ds
    movw %ax, %es
c010000e:	8e c0                	mov    %eax,%es
    movw %ax, %ss
c0100010:	8e d0                	mov    %eax,%ss

    ljmp $KERNEL_CS, $relocated
c0100012:	ea 19 00 10 c0 08 00 	ljmp   $0x8,$0xc0100019

c0100019 <relocated>:

relocated:

    # set ebp, esp
    movl $0x0, %ebp
c0100019:	bd 00 00 00 00       	mov    $0x0,%ebp
    # the kernel stack region is from bootstack -- bootstacktop,
    # the kernel stack size is KSTACKSIZE (8KB)defined in memlayout.h
    movl $bootstacktop, %esp
c010001e:	bc 00 70 12 c0       	mov    $0xc0127000,%esp
    # now kernel stack is ready , call the first C function
    call kern_init
c0100023:	e8 04 00 00 00       	call   c010002c <kern_init>

c0100028 <spin>:

# should never get here
spin:
    jmp spin
c0100028:	eb fe                	jmp    c0100028 <spin>
	...

c010002c <kern_init>:
#include <vmm.h>

int kern_init(void) __attribute__((noreturn));

int
kern_init(void) {
c010002c:	55                   	push   %ebp
c010002d:	89 e5                	mov    %esp,%ebp
c010002f:	83 ec 28             	sub    $0x28,%esp
    extern char edata[], end[];
    memset(edata, 0, end - edata);
c0100032:	ba bc 8c 12 c0       	mov    $0xc0128cbc,%edx
c0100037:	b8 a0 7a 12 c0       	mov    $0xc0127aa0,%eax
c010003c:	89 d1                	mov    %edx,%ecx
c010003e:	29 c1                	sub    %eax,%ecx
c0100040:	89 c8                	mov    %ecx,%eax
c0100042:	89 44 24 08          	mov    %eax,0x8(%esp)
c0100046:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
c010004d:	00 
c010004e:	c7 04 24 a0 7a 12 c0 	movl   $0xc0127aa0,(%esp)
c0100055:	e8 e9 ab 00 00       	call   c010ac43 <memset>

    cons_init();                // init the console
c010005a:	e8 64 33 00 00       	call   c01033c3 <cons_init>

    const char *message = "(THU.CST) os is loading ...";
c010005f:	c7 45 f4 e0 ad 10 c0 	movl   $0xc010ade0,-0xc(%ebp)
    cprintf("%s\n\n", message);
c0100066:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0100069:	89 44 24 04          	mov    %eax,0x4(%esp)
c010006d:	c7 04 24 fc ad 10 c0 	movl   $0xc010adfc,(%esp)
c0100074:	e8 53 15 00 00       	call   c01015cc <cprintf>

    print_kerninfo();
c0100079:	e8 97 1a 00 00       	call   c0101b15 <print_kerninfo>

    debug_init();               // init debug registers
c010007e:	e8 9f 20 00 00       	call   c0102122 <debug_init>
    pmm_init();                 // init physical memory management
c0100083:	e8 44 65 00 00       	call   c01065cc <pmm_init>

    pic_init();                 // init interrupt controller
c0100088:	e8 a8 34 00 00       	call   c0103535 <pic_init>
    idt_init();                 // init interrupt descriptor table
c010008d:	e8 20 36 00 00       	call   c01036b2 <idt_init>

    vmm_init();                 // init virtual memory management
c0100092:	e8 af 99 00 00       	call   c0109a46 <vmm_init>

    clock_init();               // init clock interrupt
c0100097:	e8 d4 2a 00 00       	call   c0102b70 <clock_init>
    intr_enable();              // enable irq interrupt
c010009c:	e8 fb 33 00 00       	call   c010349c <intr_enable>

    /* do nothing */
    while (1);
c01000a1:	eb fe                	jmp    c01000a1 <kern_init+0x75>
	...

c01000a4 <rb_node_create>:
#include <rb_tree.h>
#include <assert.h>

/* rb_node_create - create a new rb_node */
static inline rb_node *
rb_node_create(void) {
c01000a4:	55                   	push   %ebp
c01000a5:	89 e5                	mov    %esp,%ebp
c01000a7:	83 ec 18             	sub    $0x18,%esp
    return kmalloc(sizeof(rb_node));
c01000aa:	c7 04 24 10 00 00 00 	movl   $0x10,(%esp)
c01000b1:	e8 7f 80 00 00       	call   c0108135 <kmalloc>
}
c01000b6:	c9                   	leave  
c01000b7:	c3                   	ret    

c01000b8 <rb_tree_empty>:

/* rb_tree_empty - tests if tree is empty */
static inline bool
rb_tree_empty(rb_tree *tree) {
c01000b8:	55                   	push   %ebp
c01000b9:	89 e5                	mov    %esp,%ebp
c01000bb:	83 ec 10             	sub    $0x10,%esp
    rb_node *nil = tree->nil, *root = tree->root;
c01000be:	8b 45 08             	mov    0x8(%ebp),%eax
c01000c1:	8b 40 04             	mov    0x4(%eax),%eax
c01000c4:	89 45 f8             	mov    %eax,-0x8(%ebp)
c01000c7:	8b 45 08             	mov    0x8(%ebp),%eax
c01000ca:	8b 40 08             	mov    0x8(%eax),%eax
c01000cd:	89 45 fc             	mov    %eax,-0x4(%ebp)
    return root->left == nil;
c01000d0:	8b 45 fc             	mov    -0x4(%ebp),%eax
c01000d3:	8b 40 08             	mov    0x8(%eax),%eax
c01000d6:	3b 45 f8             	cmp    -0x8(%ebp),%eax
c01000d9:	0f 94 c0             	sete   %al
c01000dc:	0f b6 c0             	movzbl %al,%eax
}
c01000df:	c9                   	leave  
c01000e0:	c3                   	ret    

c01000e1 <rb_tree_create>:
 * Note that, root->left should always point to the node that is the root
 * of the tree. And nil points to a 'NULL' node which should always be
 * black and may have arbitrary children and parent node.
 * */
rb_tree *
rb_tree_create(int (*compare)(rb_node *node1, rb_node *node2)) {
c01000e1:	55                   	push   %ebp
c01000e2:	89 e5                	mov    %esp,%ebp
c01000e4:	83 ec 28             	sub    $0x28,%esp
    assert(compare != NULL);
c01000e7:	83 7d 08 00          	cmpl   $0x0,0x8(%ebp)
c01000eb:	75 24                	jne    c0100111 <rb_tree_create+0x30>
c01000ed:	c7 44 24 0c 04 ae 10 	movl   $0xc010ae04,0xc(%esp)
c01000f4:	c0 
c01000f5:	c7 44 24 08 14 ae 10 	movl   $0xc010ae14,0x8(%esp)
c01000fc:	c0 
c01000fd:	c7 44 24 04 1f 00 00 	movl   $0x1f,0x4(%esp)
c0100104:	00 
c0100105:	c7 04 24 29 ae 10 c0 	movl   $0xc010ae29,(%esp)
c010010c:	e8 9f 29 00 00       	call   c0102ab0 <__panic>

    rb_tree *tree;
    rb_node *nil, *root;

    if ((tree = kmalloc(sizeof(rb_tree))) == NULL) {
c0100111:	c7 04 24 0c 00 00 00 	movl   $0xc,(%esp)
c0100118:	e8 18 80 00 00       	call   c0108135 <kmalloc>
c010011d:	89 45 ec             	mov    %eax,-0x14(%ebp)
c0100120:	83 7d ec 00          	cmpl   $0x0,-0x14(%ebp)
c0100124:	0f 84 af 00 00 00    	je     c01001d9 <rb_tree_create+0xf8>
        goto bad_tree;
    }

    tree->compare = compare;
c010012a:	8b 45 ec             	mov    -0x14(%ebp),%eax
c010012d:	8b 55 08             	mov    0x8(%ebp),%edx
c0100130:	89 10                	mov    %edx,(%eax)

    if ((nil = rb_node_create()) == NULL) {
c0100132:	e8 6d ff ff ff       	call   c01000a4 <rb_node_create>
c0100137:	89 45 f0             	mov    %eax,-0x10(%ebp)
c010013a:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
c010013e:	0f 84 87 00 00 00    	je     c01001cb <rb_tree_create+0xea>
        goto bad_node_cleanup_tree;
    }

    nil->parent = nil->left = nil->right = nil;
c0100144:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0100147:	8b 55 f0             	mov    -0x10(%ebp),%edx
c010014a:	89 50 0c             	mov    %edx,0xc(%eax)
c010014d:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0100150:	8b 50 0c             	mov    0xc(%eax),%edx
c0100153:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0100156:	89 50 08             	mov    %edx,0x8(%eax)
c0100159:	8b 45 f0             	mov    -0x10(%ebp),%eax
c010015c:	8b 50 08             	mov    0x8(%eax),%edx
c010015f:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0100162:	89 50 04             	mov    %edx,0x4(%eax)
    nil->red = 0;
c0100165:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0100168:	c7 00 00 00 00 00    	movl   $0x0,(%eax)
    tree->nil = nil;
c010016e:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0100171:	8b 55 f0             	mov    -0x10(%ebp),%edx
c0100174:	89 50 04             	mov    %edx,0x4(%eax)

    if ((root = rb_node_create()) == NULL) {
c0100177:	e8 28 ff ff ff       	call   c01000a4 <rb_node_create>
c010017c:	89 45 f4             	mov    %eax,-0xc(%ebp)
c010017f:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c0100183:	74 38                	je     c01001bd <rb_tree_create+0xdc>
        goto bad_node_cleanup_nil;
    }

    root->parent = root->left = root->right = nil;
c0100185:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0100188:	8b 55 f0             	mov    -0x10(%ebp),%edx
c010018b:	89 50 0c             	mov    %edx,0xc(%eax)
c010018e:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0100191:	8b 50 0c             	mov    0xc(%eax),%edx
c0100194:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0100197:	89 50 08             	mov    %edx,0x8(%eax)
c010019a:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010019d:	8b 50 08             	mov    0x8(%eax),%edx
c01001a0:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01001a3:	89 50 04             	mov    %edx,0x4(%eax)
    root->red = 0;
c01001a6:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01001a9:	c7 00 00 00 00 00    	movl   $0x0,(%eax)
    tree->root = root;
c01001af:	8b 45 ec             	mov    -0x14(%ebp),%eax
c01001b2:	8b 55 f4             	mov    -0xc(%ebp),%edx
c01001b5:	89 50 08             	mov    %edx,0x8(%eax)
    return tree;
c01001b8:	8b 45 ec             	mov    -0x14(%ebp),%eax
c01001bb:	eb 22                	jmp    c01001df <rb_tree_create+0xfe>
    nil->parent = nil->left = nil->right = nil;
    nil->red = 0;
    tree->nil = nil;

    if ((root = rb_node_create()) == NULL) {
        goto bad_node_cleanup_nil;
c01001bd:	90                   	nop
    root->red = 0;
    tree->root = root;
    return tree;

bad_node_cleanup_nil:
    kfree(nil);
c01001be:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01001c1:	89 04 24             	mov    %eax,(%esp)
c01001c4:	e8 9b 82 00 00       	call   c0108464 <kfree>
c01001c9:	eb 01                	jmp    c01001cc <rb_tree_create+0xeb>
    }

    tree->compare = compare;

    if ((nil = rb_node_create()) == NULL) {
        goto bad_node_cleanup_tree;
c01001cb:	90                   	nop
    return tree;

bad_node_cleanup_nil:
    kfree(nil);
bad_node_cleanup_tree:
    kfree(tree);
c01001cc:	8b 45 ec             	mov    -0x14(%ebp),%eax
c01001cf:	89 04 24             	mov    %eax,(%esp)
c01001d2:	e8 8d 82 00 00       	call   c0108464 <kfree>
c01001d7:	eb 01                	jmp    c01001da <rb_tree_create+0xf9>

    rb_tree *tree;
    rb_node *nil, *root;

    if ((tree = kmalloc(sizeof(rb_tree))) == NULL) {
        goto bad_tree;
c01001d9:	90                   	nop
bad_node_cleanup_nil:
    kfree(nil);
bad_node_cleanup_tree:
    kfree(tree);
bad_tree:
    return NULL;
c01001da:	b8 00 00 00 00       	mov    $0x0,%eax
}
c01001df:	c9                   	leave  
c01001e0:	c3                   	ret    

c01001e1 <rb_left_rotate>:
    y->_left = x;                                               \
    x->parent = y;                                              \
    assert(!(nil->red));                                        \
}

FUNC_ROTATE(rb_left_rotate, left, right);
c01001e1:	55                   	push   %ebp
c01001e2:	89 e5                	mov    %esp,%ebp
c01001e4:	83 ec 28             	sub    $0x28,%esp
c01001e7:	8b 45 08             	mov    0x8(%ebp),%eax
c01001ea:	8b 40 04             	mov    0x4(%eax),%eax
c01001ed:	89 45 f0             	mov    %eax,-0x10(%ebp)
c01001f0:	8b 45 0c             	mov    0xc(%ebp),%eax
c01001f3:	8b 40 0c             	mov    0xc(%eax),%eax
c01001f6:	89 45 f4             	mov    %eax,-0xc(%ebp)
c01001f9:	8b 45 08             	mov    0x8(%ebp),%eax
c01001fc:	8b 40 08             	mov    0x8(%eax),%eax
c01001ff:	3b 45 0c             	cmp    0xc(%ebp),%eax
c0100202:	74 10                	je     c0100214 <rb_left_rotate+0x33>
c0100204:	8b 45 0c             	mov    0xc(%ebp),%eax
c0100207:	3b 45 f0             	cmp    -0x10(%ebp),%eax
c010020a:	74 08                	je     c0100214 <rb_left_rotate+0x33>
c010020c:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010020f:	3b 45 f0             	cmp    -0x10(%ebp),%eax
c0100212:	75 24                	jne    c0100238 <rb_left_rotate+0x57>
c0100214:	c7 44 24 0c 40 ae 10 	movl   $0xc010ae40,0xc(%esp)
c010021b:	c0 
c010021c:	c7 44 24 08 14 ae 10 	movl   $0xc010ae14,0x8(%esp)
c0100223:	c0 
c0100224:	c7 44 24 04 64 00 00 	movl   $0x64,0x4(%esp)
c010022b:	00 
c010022c:	c7 04 24 29 ae 10 c0 	movl   $0xc010ae29,(%esp)
c0100233:	e8 78 28 00 00       	call   c0102ab0 <__panic>
c0100238:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010023b:	8b 50 08             	mov    0x8(%eax),%edx
c010023e:	8b 45 0c             	mov    0xc(%ebp),%eax
c0100241:	89 50 0c             	mov    %edx,0xc(%eax)
c0100244:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0100247:	8b 40 08             	mov    0x8(%eax),%eax
c010024a:	3b 45 f0             	cmp    -0x10(%ebp),%eax
c010024d:	74 0c                	je     c010025b <rb_left_rotate+0x7a>
c010024f:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0100252:	8b 40 08             	mov    0x8(%eax),%eax
c0100255:	8b 55 0c             	mov    0xc(%ebp),%edx
c0100258:	89 50 04             	mov    %edx,0x4(%eax)
c010025b:	8b 45 0c             	mov    0xc(%ebp),%eax
c010025e:	8b 50 04             	mov    0x4(%eax),%edx
c0100261:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0100264:	89 50 04             	mov    %edx,0x4(%eax)
c0100267:	8b 45 0c             	mov    0xc(%ebp),%eax
c010026a:	8b 40 04             	mov    0x4(%eax),%eax
c010026d:	8b 40 08             	mov    0x8(%eax),%eax
c0100270:	3b 45 0c             	cmp    0xc(%ebp),%eax
c0100273:	75 0e                	jne    c0100283 <rb_left_rotate+0xa2>
c0100275:	8b 45 0c             	mov    0xc(%ebp),%eax
c0100278:	8b 40 04             	mov    0x4(%eax),%eax
c010027b:	8b 55 f4             	mov    -0xc(%ebp),%edx
c010027e:	89 50 08             	mov    %edx,0x8(%eax)
c0100281:	eb 0c                	jmp    c010028f <rb_left_rotate+0xae>
c0100283:	8b 45 0c             	mov    0xc(%ebp),%eax
c0100286:	8b 40 04             	mov    0x4(%eax),%eax
c0100289:	8b 55 f4             	mov    -0xc(%ebp),%edx
c010028c:	89 50 0c             	mov    %edx,0xc(%eax)
c010028f:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0100292:	8b 55 0c             	mov    0xc(%ebp),%edx
c0100295:	89 50 08             	mov    %edx,0x8(%eax)
c0100298:	8b 45 0c             	mov    0xc(%ebp),%eax
c010029b:	8b 55 f4             	mov    -0xc(%ebp),%edx
c010029e:	89 50 04             	mov    %edx,0x4(%eax)
c01002a1:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01002a4:	8b 00                	mov    (%eax),%eax
c01002a6:	85 c0                	test   %eax,%eax
c01002a8:	74 24                	je     c01002ce <rb_left_rotate+0xed>
c01002aa:	c7 44 24 0c 68 ae 10 	movl   $0xc010ae68,0xc(%esp)
c01002b1:	c0 
c01002b2:	c7 44 24 08 14 ae 10 	movl   $0xc010ae14,0x8(%esp)
c01002b9:	c0 
c01002ba:	c7 44 24 04 64 00 00 	movl   $0x64,0x4(%esp)
c01002c1:	00 
c01002c2:	c7 04 24 29 ae 10 c0 	movl   $0xc010ae29,(%esp)
c01002c9:	e8 e2 27 00 00       	call   c0102ab0 <__panic>
c01002ce:	c9                   	leave  
c01002cf:	c3                   	ret    

c01002d0 <rb_right_rotate>:
FUNC_ROTATE(rb_right_rotate, right, left);
c01002d0:	55                   	push   %ebp
c01002d1:	89 e5                	mov    %esp,%ebp
c01002d3:	83 ec 28             	sub    $0x28,%esp
c01002d6:	8b 45 08             	mov    0x8(%ebp),%eax
c01002d9:	8b 40 04             	mov    0x4(%eax),%eax
c01002dc:	89 45 f0             	mov    %eax,-0x10(%ebp)
c01002df:	8b 45 0c             	mov    0xc(%ebp),%eax
c01002e2:	8b 40 08             	mov    0x8(%eax),%eax
c01002e5:	89 45 f4             	mov    %eax,-0xc(%ebp)
c01002e8:	8b 45 08             	mov    0x8(%ebp),%eax
c01002eb:	8b 40 08             	mov    0x8(%eax),%eax
c01002ee:	3b 45 0c             	cmp    0xc(%ebp),%eax
c01002f1:	74 10                	je     c0100303 <rb_right_rotate+0x33>
c01002f3:	8b 45 0c             	mov    0xc(%ebp),%eax
c01002f6:	3b 45 f0             	cmp    -0x10(%ebp),%eax
c01002f9:	74 08                	je     c0100303 <rb_right_rotate+0x33>
c01002fb:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01002fe:	3b 45 f0             	cmp    -0x10(%ebp),%eax
c0100301:	75 24                	jne    c0100327 <rb_right_rotate+0x57>
c0100303:	c7 44 24 0c 40 ae 10 	movl   $0xc010ae40,0xc(%esp)
c010030a:	c0 
c010030b:	c7 44 24 08 14 ae 10 	movl   $0xc010ae14,0x8(%esp)
c0100312:	c0 
c0100313:	c7 44 24 04 65 00 00 	movl   $0x65,0x4(%esp)
c010031a:	00 
c010031b:	c7 04 24 29 ae 10 c0 	movl   $0xc010ae29,(%esp)
c0100322:	e8 89 27 00 00       	call   c0102ab0 <__panic>
c0100327:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010032a:	8b 50 0c             	mov    0xc(%eax),%edx
c010032d:	8b 45 0c             	mov    0xc(%ebp),%eax
c0100330:	89 50 08             	mov    %edx,0x8(%eax)
c0100333:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0100336:	8b 40 0c             	mov    0xc(%eax),%eax
c0100339:	3b 45 f0             	cmp    -0x10(%ebp),%eax
c010033c:	74 0c                	je     c010034a <rb_right_rotate+0x7a>
c010033e:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0100341:	8b 40 0c             	mov    0xc(%eax),%eax
c0100344:	8b 55 0c             	mov    0xc(%ebp),%edx
c0100347:	89 50 04             	mov    %edx,0x4(%eax)
c010034a:	8b 45 0c             	mov    0xc(%ebp),%eax
c010034d:	8b 50 04             	mov    0x4(%eax),%edx
c0100350:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0100353:	89 50 04             	mov    %edx,0x4(%eax)
c0100356:	8b 45 0c             	mov    0xc(%ebp),%eax
c0100359:	8b 40 04             	mov    0x4(%eax),%eax
c010035c:	8b 40 0c             	mov    0xc(%eax),%eax
c010035f:	3b 45 0c             	cmp    0xc(%ebp),%eax
c0100362:	75 0e                	jne    c0100372 <rb_right_rotate+0xa2>
c0100364:	8b 45 0c             	mov    0xc(%ebp),%eax
c0100367:	8b 40 04             	mov    0x4(%eax),%eax
c010036a:	8b 55 f4             	mov    -0xc(%ebp),%edx
c010036d:	89 50 0c             	mov    %edx,0xc(%eax)
c0100370:	eb 0c                	jmp    c010037e <rb_right_rotate+0xae>
c0100372:	8b 45 0c             	mov    0xc(%ebp),%eax
c0100375:	8b 40 04             	mov    0x4(%eax),%eax
c0100378:	8b 55 f4             	mov    -0xc(%ebp),%edx
c010037b:	89 50 08             	mov    %edx,0x8(%eax)
c010037e:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0100381:	8b 55 0c             	mov    0xc(%ebp),%edx
c0100384:	89 50 0c             	mov    %edx,0xc(%eax)
c0100387:	8b 45 0c             	mov    0xc(%ebp),%eax
c010038a:	8b 55 f4             	mov    -0xc(%ebp),%edx
c010038d:	89 50 04             	mov    %edx,0x4(%eax)
c0100390:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0100393:	8b 00                	mov    (%eax),%eax
c0100395:	85 c0                	test   %eax,%eax
c0100397:	74 24                	je     c01003bd <rb_right_rotate+0xed>
c0100399:	c7 44 24 0c 68 ae 10 	movl   $0xc010ae68,0xc(%esp)
c01003a0:	c0 
c01003a1:	c7 44 24 08 14 ae 10 	movl   $0xc010ae14,0x8(%esp)
c01003a8:	c0 
c01003a9:	c7 44 24 04 65 00 00 	movl   $0x65,0x4(%esp)
c01003b0:	00 
c01003b1:	c7 04 24 29 ae 10 c0 	movl   $0xc010ae29,(%esp)
c01003b8:	e8 f3 26 00 00       	call   c0102ab0 <__panic>
c01003bd:	c9                   	leave  
c01003be:	c3                   	ret    

c01003bf <rb_insert_binary>:
 * rb_insert_binary - insert @node to red-black @tree as if it were
 * a regular binary tree. This function is only intended to be called
 * by function rb_insert.
 * */
static inline void
rb_insert_binary(rb_tree *tree, rb_node *node) {
c01003bf:	55                   	push   %ebp
c01003c0:	89 e5                	mov    %esp,%ebp
c01003c2:	83 ec 38             	sub    $0x38,%esp
    rb_node *x, *y, *z = node, *nil = tree->nil, *root = tree->root;
c01003c5:	8b 45 0c             	mov    0xc(%ebp),%eax
c01003c8:	89 45 ec             	mov    %eax,-0x14(%ebp)
c01003cb:	8b 45 08             	mov    0x8(%ebp),%eax
c01003ce:	8b 40 04             	mov    0x4(%eax),%eax
c01003d1:	89 45 f0             	mov    %eax,-0x10(%ebp)
c01003d4:	8b 45 08             	mov    0x8(%ebp),%eax
c01003d7:	8b 40 08             	mov    0x8(%eax),%eax
c01003da:	89 45 f4             	mov    %eax,-0xc(%ebp)

    z->left = z->right = nil;
c01003dd:	8b 45 ec             	mov    -0x14(%ebp),%eax
c01003e0:	8b 55 f0             	mov    -0x10(%ebp),%edx
c01003e3:	89 50 0c             	mov    %edx,0xc(%eax)
c01003e6:	8b 45 ec             	mov    -0x14(%ebp),%eax
c01003e9:	8b 50 0c             	mov    0xc(%eax),%edx
c01003ec:	8b 45 ec             	mov    -0x14(%ebp),%eax
c01003ef:	89 50 08             	mov    %edx,0x8(%eax)
    y = root, x = y->left;
c01003f2:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01003f5:	89 45 e8             	mov    %eax,-0x18(%ebp)
c01003f8:	8b 45 e8             	mov    -0x18(%ebp),%eax
c01003fb:	8b 40 08             	mov    0x8(%eax),%eax
c01003fe:	89 45 e4             	mov    %eax,-0x1c(%ebp)
    while (x != nil) {
c0100401:	eb 2f                	jmp    c0100432 <rb_insert_binary+0x73>
        y = x;
c0100403:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0100406:	89 45 e8             	mov    %eax,-0x18(%ebp)
        x = (COMPARE(tree, x, node) > 0) ? x->left : x->right;
c0100409:	8b 45 08             	mov    0x8(%ebp),%eax
c010040c:	8b 10                	mov    (%eax),%edx
c010040e:	8b 45 0c             	mov    0xc(%ebp),%eax
c0100411:	89 44 24 04          	mov    %eax,0x4(%esp)
c0100415:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0100418:	89 04 24             	mov    %eax,(%esp)
c010041b:	ff d2                	call   *%edx
c010041d:	85 c0                	test   %eax,%eax
c010041f:	7e 08                	jle    c0100429 <rb_insert_binary+0x6a>
c0100421:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0100424:	8b 40 08             	mov    0x8(%eax),%eax
c0100427:	eb 06                	jmp    c010042f <rb_insert_binary+0x70>
c0100429:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c010042c:	8b 40 0c             	mov    0xc(%eax),%eax
c010042f:	89 45 e4             	mov    %eax,-0x1c(%ebp)
rb_insert_binary(rb_tree *tree, rb_node *node) {
    rb_node *x, *y, *z = node, *nil = tree->nil, *root = tree->root;

    z->left = z->right = nil;
    y = root, x = y->left;
    while (x != nil) {
c0100432:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0100435:	3b 45 f0             	cmp    -0x10(%ebp),%eax
c0100438:	75 c9                	jne    c0100403 <rb_insert_binary+0x44>
        y = x;
        x = (COMPARE(tree, x, node) > 0) ? x->left : x->right;
    }
    z->parent = y;
c010043a:	8b 45 ec             	mov    -0x14(%ebp),%eax
c010043d:	8b 55 e8             	mov    -0x18(%ebp),%edx
c0100440:	89 50 04             	mov    %edx,0x4(%eax)
    if (y == root || COMPARE(tree, y, z) > 0) {
c0100443:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0100446:	3b 45 f4             	cmp    -0xc(%ebp),%eax
c0100449:	74 18                	je     c0100463 <rb_insert_binary+0xa4>
c010044b:	8b 45 08             	mov    0x8(%ebp),%eax
c010044e:	8b 10                	mov    (%eax),%edx
c0100450:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0100453:	89 44 24 04          	mov    %eax,0x4(%esp)
c0100457:	8b 45 e8             	mov    -0x18(%ebp),%eax
c010045a:	89 04 24             	mov    %eax,(%esp)
c010045d:	ff d2                	call   *%edx
c010045f:	85 c0                	test   %eax,%eax
c0100461:	7e 0b                	jle    c010046e <rb_insert_binary+0xaf>
        y->left = z;
c0100463:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0100466:	8b 55 ec             	mov    -0x14(%ebp),%edx
c0100469:	89 50 08             	mov    %edx,0x8(%eax)
    while (x != nil) {
        y = x;
        x = (COMPARE(tree, x, node) > 0) ? x->left : x->right;
    }
    z->parent = y;
    if (y == root || COMPARE(tree, y, z) > 0) {
c010046c:	eb 09                	jmp    c0100477 <rb_insert_binary+0xb8>
        y->left = z;
    }
    else {
        y->right = z;
c010046e:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0100471:	8b 55 ec             	mov    -0x14(%ebp),%edx
c0100474:	89 50 0c             	mov    %edx,0xc(%eax)
    }
}
c0100477:	c9                   	leave  
c0100478:	c3                   	ret    

c0100479 <rb_insert>:

/* rb_insert - insert a node to red-black tree */
void
rb_insert(rb_tree *tree, rb_node *node) {
c0100479:	55                   	push   %ebp
c010047a:	89 e5                	mov    %esp,%ebp
c010047c:	83 ec 28             	sub    $0x28,%esp
    rb_insert_binary(tree, node);
c010047f:	8b 45 0c             	mov    0xc(%ebp),%eax
c0100482:	89 44 24 04          	mov    %eax,0x4(%esp)
c0100486:	8b 45 08             	mov    0x8(%ebp),%eax
c0100489:	89 04 24             	mov    %eax,(%esp)
c010048c:	e8 2e ff ff ff       	call   c01003bf <rb_insert_binary>
    node->red = 1;
c0100491:	8b 45 0c             	mov    0xc(%ebp),%eax
c0100494:	c7 00 01 00 00 00    	movl   $0x1,(%eax)

    rb_node *x = node, *y;
c010049a:	8b 45 0c             	mov    0xc(%ebp),%eax
c010049d:	89 45 f0             	mov    %eax,-0x10(%ebp)
            x->parent->parent->red = 1;                         \
            rb_##_right##_rotate(tree, x->parent->parent);      \
        }                                                       \
    } while (0)

    while (x->parent->red) {
c01004a0:	e9 6e 01 00 00       	jmp    c0100613 <rb_insert+0x19a>
        if (x->parent == x->parent->parent->left) {
c01004a5:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01004a8:	8b 50 04             	mov    0x4(%eax),%edx
c01004ab:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01004ae:	8b 40 04             	mov    0x4(%eax),%eax
c01004b1:	8b 40 04             	mov    0x4(%eax),%eax
c01004b4:	8b 40 08             	mov    0x8(%eax),%eax
c01004b7:	39 c2                	cmp    %eax,%edx
c01004b9:	0f 85 ae 00 00 00    	jne    c010056d <rb_insert+0xf4>
            RB_INSERT_SUB(left, right);
c01004bf:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01004c2:	8b 40 04             	mov    0x4(%eax),%eax
c01004c5:	8b 40 04             	mov    0x4(%eax),%eax
c01004c8:	8b 40 0c             	mov    0xc(%eax),%eax
c01004cb:	89 45 f4             	mov    %eax,-0xc(%ebp)
c01004ce:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01004d1:	8b 00                	mov    (%eax),%eax
c01004d3:	85 c0                	test   %eax,%eax
c01004d5:	74 35                	je     c010050c <rb_insert+0x93>
c01004d7:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01004da:	8b 40 04             	mov    0x4(%eax),%eax
c01004dd:	c7 00 00 00 00 00    	movl   $0x0,(%eax)
c01004e3:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01004e6:	c7 00 00 00 00 00    	movl   $0x0,(%eax)
c01004ec:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01004ef:	8b 40 04             	mov    0x4(%eax),%eax
c01004f2:	8b 40 04             	mov    0x4(%eax),%eax
c01004f5:	c7 00 01 00 00 00    	movl   $0x1,(%eax)
c01004fb:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01004fe:	8b 40 04             	mov    0x4(%eax),%eax
c0100501:	8b 40 04             	mov    0x4(%eax),%eax
c0100504:	89 45 f0             	mov    %eax,-0x10(%ebp)
c0100507:	e9 07 01 00 00       	jmp    c0100613 <rb_insert+0x19a>
c010050c:	8b 45 f0             	mov    -0x10(%ebp),%eax
c010050f:	8b 40 04             	mov    0x4(%eax),%eax
c0100512:	8b 40 0c             	mov    0xc(%eax),%eax
c0100515:	3b 45 f0             	cmp    -0x10(%ebp),%eax
c0100518:	75 1b                	jne    c0100535 <rb_insert+0xbc>
c010051a:	8b 45 f0             	mov    -0x10(%ebp),%eax
c010051d:	8b 40 04             	mov    0x4(%eax),%eax
c0100520:	89 45 f0             	mov    %eax,-0x10(%ebp)
c0100523:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0100526:	89 44 24 04          	mov    %eax,0x4(%esp)
c010052a:	8b 45 08             	mov    0x8(%ebp),%eax
c010052d:	89 04 24             	mov    %eax,(%esp)
c0100530:	e8 ac fc ff ff       	call   c01001e1 <rb_left_rotate>
c0100535:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0100538:	8b 40 04             	mov    0x4(%eax),%eax
c010053b:	c7 00 00 00 00 00    	movl   $0x0,(%eax)
c0100541:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0100544:	8b 40 04             	mov    0x4(%eax),%eax
c0100547:	8b 40 04             	mov    0x4(%eax),%eax
c010054a:	c7 00 01 00 00 00    	movl   $0x1,(%eax)
c0100550:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0100553:	8b 40 04             	mov    0x4(%eax),%eax
c0100556:	8b 40 04             	mov    0x4(%eax),%eax
c0100559:	89 44 24 04          	mov    %eax,0x4(%esp)
c010055d:	8b 45 08             	mov    0x8(%ebp),%eax
c0100560:	89 04 24             	mov    %eax,(%esp)
c0100563:	e8 68 fd ff ff       	call   c01002d0 <rb_right_rotate>
c0100568:	e9 a6 00 00 00       	jmp    c0100613 <rb_insert+0x19a>
        }
        else {
            RB_INSERT_SUB(right, left);
c010056d:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0100570:	8b 40 04             	mov    0x4(%eax),%eax
c0100573:	8b 40 04             	mov    0x4(%eax),%eax
c0100576:	8b 40 08             	mov    0x8(%eax),%eax
c0100579:	89 45 f4             	mov    %eax,-0xc(%ebp)
c010057c:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010057f:	8b 00                	mov    (%eax),%eax
c0100581:	85 c0                	test   %eax,%eax
c0100583:	74 32                	je     c01005b7 <rb_insert+0x13e>
c0100585:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0100588:	8b 40 04             	mov    0x4(%eax),%eax
c010058b:	c7 00 00 00 00 00    	movl   $0x0,(%eax)
c0100591:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0100594:	c7 00 00 00 00 00    	movl   $0x0,(%eax)
c010059a:	8b 45 f0             	mov    -0x10(%ebp),%eax
c010059d:	8b 40 04             	mov    0x4(%eax),%eax
c01005a0:	8b 40 04             	mov    0x4(%eax),%eax
c01005a3:	c7 00 01 00 00 00    	movl   $0x1,(%eax)
c01005a9:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01005ac:	8b 40 04             	mov    0x4(%eax),%eax
c01005af:	8b 40 04             	mov    0x4(%eax),%eax
c01005b2:	89 45 f0             	mov    %eax,-0x10(%ebp)
c01005b5:	eb 5c                	jmp    c0100613 <rb_insert+0x19a>
c01005b7:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01005ba:	8b 40 04             	mov    0x4(%eax),%eax
c01005bd:	8b 40 08             	mov    0x8(%eax),%eax
c01005c0:	3b 45 f0             	cmp    -0x10(%ebp),%eax
c01005c3:	75 1b                	jne    c01005e0 <rb_insert+0x167>
c01005c5:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01005c8:	8b 40 04             	mov    0x4(%eax),%eax
c01005cb:	89 45 f0             	mov    %eax,-0x10(%ebp)
c01005ce:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01005d1:	89 44 24 04          	mov    %eax,0x4(%esp)
c01005d5:	8b 45 08             	mov    0x8(%ebp),%eax
c01005d8:	89 04 24             	mov    %eax,(%esp)
c01005db:	e8 f0 fc ff ff       	call   c01002d0 <rb_right_rotate>
c01005e0:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01005e3:	8b 40 04             	mov    0x4(%eax),%eax
c01005e6:	c7 00 00 00 00 00    	movl   $0x0,(%eax)
c01005ec:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01005ef:	8b 40 04             	mov    0x4(%eax),%eax
c01005f2:	8b 40 04             	mov    0x4(%eax),%eax
c01005f5:	c7 00 01 00 00 00    	movl   $0x1,(%eax)
c01005fb:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01005fe:	8b 40 04             	mov    0x4(%eax),%eax
c0100601:	8b 40 04             	mov    0x4(%eax),%eax
c0100604:	89 44 24 04          	mov    %eax,0x4(%esp)
c0100608:	8b 45 08             	mov    0x8(%ebp),%eax
c010060b:	89 04 24             	mov    %eax,(%esp)
c010060e:	e8 ce fb ff ff       	call   c01001e1 <rb_left_rotate>
            x->parent->parent->red = 1;                         \
            rb_##_right##_rotate(tree, x->parent->parent);      \
        }                                                       \
    } while (0)

    while (x->parent->red) {
c0100613:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0100616:	8b 40 04             	mov    0x4(%eax),%eax
c0100619:	8b 00                	mov    (%eax),%eax
c010061b:	85 c0                	test   %eax,%eax
c010061d:	0f 85 82 fe ff ff    	jne    c01004a5 <rb_insert+0x2c>
        }
        else {
            RB_INSERT_SUB(right, left);
        }
    }
    tree->root->left->red = 0;
c0100623:	8b 45 08             	mov    0x8(%ebp),%eax
c0100626:	8b 40 08             	mov    0x8(%eax),%eax
c0100629:	8b 40 08             	mov    0x8(%eax),%eax
c010062c:	c7 00 00 00 00 00    	movl   $0x0,(%eax)
    assert(!(tree->nil->red) && !(tree->root->red));
c0100632:	8b 45 08             	mov    0x8(%ebp),%eax
c0100635:	8b 40 04             	mov    0x4(%eax),%eax
c0100638:	8b 00                	mov    (%eax),%eax
c010063a:	85 c0                	test   %eax,%eax
c010063c:	75 0c                	jne    c010064a <rb_insert+0x1d1>
c010063e:	8b 45 08             	mov    0x8(%ebp),%eax
c0100641:	8b 40 08             	mov    0x8(%eax),%eax
c0100644:	8b 00                	mov    (%eax),%eax
c0100646:	85 c0                	test   %eax,%eax
c0100648:	74 24                	je     c010066e <rb_insert+0x1f5>
c010064a:	c7 44 24 0c 74 ae 10 	movl   $0xc010ae74,0xc(%esp)
c0100651:	c0 
c0100652:	c7 44 24 08 14 ae 10 	movl   $0xc010ae14,0x8(%esp)
c0100659:	c0 
c010065a:	c7 44 24 04 a9 00 00 	movl   $0xa9,0x4(%esp)
c0100661:	00 
c0100662:	c7 04 24 29 ae 10 c0 	movl   $0xc010ae29,(%esp)
c0100669:	e8 42 24 00 00       	call   c0102ab0 <__panic>

#undef RB_INSERT_SUB
}
c010066e:	c9                   	leave  
c010066f:	c3                   	ret    

c0100670 <rb_tree_successor>:
 * rb_tree_successor - returns the successor of @node, or nil
 * if no successor exists. Make sure that @node must belong to @tree,
 * and this function should only be called by rb_node_prev.
 * */
static inline rb_node *
rb_tree_successor(rb_tree *tree, rb_node *node) {
c0100670:	55                   	push   %ebp
c0100671:	89 e5                	mov    %esp,%ebp
c0100673:	83 ec 10             	sub    $0x10,%esp
    rb_node *x = node, *y, *nil = tree->nil;
c0100676:	8b 45 0c             	mov    0xc(%ebp),%eax
c0100679:	89 45 f4             	mov    %eax,-0xc(%ebp)
c010067c:	8b 45 08             	mov    0x8(%ebp),%eax
c010067f:	8b 40 04             	mov    0x4(%eax),%eax
c0100682:	89 45 fc             	mov    %eax,-0x4(%ebp)

    if ((y = x->right) != nil) {
c0100685:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0100688:	8b 40 0c             	mov    0xc(%eax),%eax
c010068b:	89 45 f8             	mov    %eax,-0x8(%ebp)
c010068e:	8b 45 f8             	mov    -0x8(%ebp),%eax
c0100691:	3b 45 fc             	cmp    -0x4(%ebp),%eax
c0100694:	74 1b                	je     c01006b1 <rb_tree_successor+0x41>
        while (y->left != nil) {
c0100696:	eb 09                	jmp    c01006a1 <rb_tree_successor+0x31>
            y = y->left;
c0100698:	8b 45 f8             	mov    -0x8(%ebp),%eax
c010069b:	8b 40 08             	mov    0x8(%eax),%eax
c010069e:	89 45 f8             	mov    %eax,-0x8(%ebp)
static inline rb_node *
rb_tree_successor(rb_tree *tree, rb_node *node) {
    rb_node *x = node, *y, *nil = tree->nil;

    if ((y = x->right) != nil) {
        while (y->left != nil) {
c01006a1:	8b 45 f8             	mov    -0x8(%ebp),%eax
c01006a4:	8b 40 08             	mov    0x8(%eax),%eax
c01006a7:	3b 45 fc             	cmp    -0x4(%ebp),%eax
c01006aa:	75 ec                	jne    c0100698 <rb_tree_successor+0x28>
            y = y->left;
        }
        return y;
c01006ac:	8b 45 f8             	mov    -0x8(%ebp),%eax
c01006af:	eb 38                	jmp    c01006e9 <rb_tree_successor+0x79>
    }
    else {
        y = x->parent;
c01006b1:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01006b4:	8b 40 04             	mov    0x4(%eax),%eax
c01006b7:	89 45 f8             	mov    %eax,-0x8(%ebp)
        while (x == y->right) {
c01006ba:	eb 0f                	jmp    c01006cb <rb_tree_successor+0x5b>
            x = y, y = y->parent;
c01006bc:	8b 45 f8             	mov    -0x8(%ebp),%eax
c01006bf:	89 45 f4             	mov    %eax,-0xc(%ebp)
c01006c2:	8b 45 f8             	mov    -0x8(%ebp),%eax
c01006c5:	8b 40 04             	mov    0x4(%eax),%eax
c01006c8:	89 45 f8             	mov    %eax,-0x8(%ebp)
        }
        return y;
    }
    else {
        y = x->parent;
        while (x == y->right) {
c01006cb:	8b 45 f8             	mov    -0x8(%ebp),%eax
c01006ce:	8b 40 0c             	mov    0xc(%eax),%eax
c01006d1:	3b 45 f4             	cmp    -0xc(%ebp),%eax
c01006d4:	74 e6                	je     c01006bc <rb_tree_successor+0x4c>
            x = y, y = y->parent;
        }
        if (y == tree->root) {
c01006d6:	8b 45 08             	mov    0x8(%ebp),%eax
c01006d9:	8b 40 08             	mov    0x8(%eax),%eax
c01006dc:	3b 45 f8             	cmp    -0x8(%ebp),%eax
c01006df:	75 05                	jne    c01006e6 <rb_tree_successor+0x76>
            return nil;
c01006e1:	8b 45 fc             	mov    -0x4(%ebp),%eax
c01006e4:	eb 03                	jmp    c01006e9 <rb_tree_successor+0x79>
        }
        return y;
c01006e6:	8b 45 f8             	mov    -0x8(%ebp),%eax
    }
}
c01006e9:	c9                   	leave  
c01006ea:	c3                   	ret    

c01006eb <rb_tree_predecessor>:
/* *
 * rb_tree_predecessor - returns the predecessor of @node, or nil
 * if no predecessor exists, likes rb_tree_successor.
 * */
static inline rb_node *
rb_tree_predecessor(rb_tree *tree, rb_node *node) {
c01006eb:	55                   	push   %ebp
c01006ec:	89 e5                	mov    %esp,%ebp
c01006ee:	83 ec 10             	sub    $0x10,%esp
    rb_node *x = node, *y, *nil = tree->nil;
c01006f1:	8b 45 0c             	mov    0xc(%ebp),%eax
c01006f4:	89 45 f4             	mov    %eax,-0xc(%ebp)
c01006f7:	8b 45 08             	mov    0x8(%ebp),%eax
c01006fa:	8b 40 04             	mov    0x4(%eax),%eax
c01006fd:	89 45 fc             	mov    %eax,-0x4(%ebp)

    if ((y = x->left) != nil) {
c0100700:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0100703:	8b 40 08             	mov    0x8(%eax),%eax
c0100706:	89 45 f8             	mov    %eax,-0x8(%ebp)
c0100709:	8b 45 f8             	mov    -0x8(%ebp),%eax
c010070c:	3b 45 fc             	cmp    -0x4(%ebp),%eax
c010070f:	74 1b                	je     c010072c <rb_tree_predecessor+0x41>
        while (y->right != nil) {
c0100711:	eb 09                	jmp    c010071c <rb_tree_predecessor+0x31>
            y = y->right;
c0100713:	8b 45 f8             	mov    -0x8(%ebp),%eax
c0100716:	8b 40 0c             	mov    0xc(%eax),%eax
c0100719:	89 45 f8             	mov    %eax,-0x8(%ebp)
static inline rb_node *
rb_tree_predecessor(rb_tree *tree, rb_node *node) {
    rb_node *x = node, *y, *nil = tree->nil;

    if ((y = x->left) != nil) {
        while (y->right != nil) {
c010071c:	8b 45 f8             	mov    -0x8(%ebp),%eax
c010071f:	8b 40 0c             	mov    0xc(%eax),%eax
c0100722:	3b 45 fc             	cmp    -0x4(%ebp),%eax
c0100725:	75 ec                	jne    c0100713 <rb_tree_predecessor+0x28>
            y = y->right;
        }
        return y;
c0100727:	8b 45 f8             	mov    -0x8(%ebp),%eax
c010072a:	eb 38                	jmp    c0100764 <rb_tree_predecessor+0x79>
    }
    else {
        y = x->parent;
c010072c:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010072f:	8b 40 04             	mov    0x4(%eax),%eax
c0100732:	89 45 f8             	mov    %eax,-0x8(%ebp)
        while (x == y->left) {
c0100735:	eb 1f                	jmp    c0100756 <rb_tree_predecessor+0x6b>
            if (y == tree->root) {
c0100737:	8b 45 08             	mov    0x8(%ebp),%eax
c010073a:	8b 40 08             	mov    0x8(%eax),%eax
c010073d:	3b 45 f8             	cmp    -0x8(%ebp),%eax
c0100740:	75 05                	jne    c0100747 <rb_tree_predecessor+0x5c>
                return nil;
c0100742:	8b 45 fc             	mov    -0x4(%ebp),%eax
c0100745:	eb 1d                	jmp    c0100764 <rb_tree_predecessor+0x79>
            }
            x = y, y = y->parent;
c0100747:	8b 45 f8             	mov    -0x8(%ebp),%eax
c010074a:	89 45 f4             	mov    %eax,-0xc(%ebp)
c010074d:	8b 45 f8             	mov    -0x8(%ebp),%eax
c0100750:	8b 40 04             	mov    0x4(%eax),%eax
c0100753:	89 45 f8             	mov    %eax,-0x8(%ebp)
        }
        return y;
    }
    else {
        y = x->parent;
        while (x == y->left) {
c0100756:	8b 45 f8             	mov    -0x8(%ebp),%eax
c0100759:	8b 40 08             	mov    0x8(%eax),%eax
c010075c:	3b 45 f4             	cmp    -0xc(%ebp),%eax
c010075f:	74 d6                	je     c0100737 <rb_tree_predecessor+0x4c>
            if (y == tree->root) {
                return nil;
            }
            x = y, y = y->parent;
        }
        return y;
c0100761:	8b 45 f8             	mov    -0x8(%ebp),%eax
    }
}
c0100764:	c9                   	leave  
c0100765:	c3                   	ret    

c0100766 <rb_search>:
 * rb_search - returns a node with value 'equal' to @key (according to
 * function @compare). If there're multiple nodes with value 'equal' to @key,
 * the functions returns the one highest in the tree.
 * */
rb_node *
rb_search(rb_tree *tree, int (*compare)(rb_node *node, void *key), void *key) {
c0100766:	55                   	push   %ebp
c0100767:	89 e5                	mov    %esp,%ebp
c0100769:	83 ec 28             	sub    $0x28,%esp
    rb_node *nil = tree->nil, *node = tree->root->left;
c010076c:	8b 45 08             	mov    0x8(%ebp),%eax
c010076f:	8b 40 04             	mov    0x4(%eax),%eax
c0100772:	89 45 ec             	mov    %eax,-0x14(%ebp)
c0100775:	8b 45 08             	mov    0x8(%ebp),%eax
c0100778:	8b 40 08             	mov    0x8(%eax),%eax
c010077b:	8b 40 08             	mov    0x8(%eax),%eax
c010077e:	89 45 f0             	mov    %eax,-0x10(%ebp)
    int r;
    while (node != nil && (r = compare(node, key)) != 0) {
c0100781:	eb 17                	jmp    c010079a <rb_search+0x34>
        node = (r > 0) ? node->left : node->right;
c0100783:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c0100787:	7e 08                	jle    c0100791 <rb_search+0x2b>
c0100789:	8b 45 f0             	mov    -0x10(%ebp),%eax
c010078c:	8b 40 08             	mov    0x8(%eax),%eax
c010078f:	eb 06                	jmp    c0100797 <rb_search+0x31>
c0100791:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0100794:	8b 40 0c             	mov    0xc(%eax),%eax
c0100797:	89 45 f0             	mov    %eax,-0x10(%ebp)
 * */
rb_node *
rb_search(rb_tree *tree, int (*compare)(rb_node *node, void *key), void *key) {
    rb_node *nil = tree->nil, *node = tree->root->left;
    int r;
    while (node != nil && (r = compare(node, key)) != 0) {
c010079a:	8b 45 f0             	mov    -0x10(%ebp),%eax
c010079d:	3b 45 ec             	cmp    -0x14(%ebp),%eax
c01007a0:	74 1b                	je     c01007bd <rb_search+0x57>
c01007a2:	8b 45 10             	mov    0x10(%ebp),%eax
c01007a5:	89 44 24 04          	mov    %eax,0x4(%esp)
c01007a9:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01007ac:	89 04 24             	mov    %eax,(%esp)
c01007af:	8b 45 0c             	mov    0xc(%ebp),%eax
c01007b2:	ff d0                	call   *%eax
c01007b4:	89 45 f4             	mov    %eax,-0xc(%ebp)
c01007b7:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c01007bb:	75 c6                	jne    c0100783 <rb_search+0x1d>
        node = (r > 0) ? node->left : node->right;
    }
    return (node != nil) ? node : NULL;
c01007bd:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01007c0:	3b 45 ec             	cmp    -0x14(%ebp),%eax
c01007c3:	74 05                	je     c01007ca <rb_search+0x64>
c01007c5:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01007c8:	eb 05                	jmp    c01007cf <rb_search+0x69>
c01007ca:	b8 00 00 00 00       	mov    $0x0,%eax
}
c01007cf:	c9                   	leave  
c01007d0:	c3                   	ret    

c01007d1 <rb_delete_fixup>:
/* *
 * rb_delete_fixup - performs rotations and changes colors to restore
 * red-black properties after a node is deleted.
 * */
static void
rb_delete_fixup(rb_tree *tree, rb_node *node) {
c01007d1:	55                   	push   %ebp
c01007d2:	89 e5                	mov    %esp,%ebp
c01007d4:	83 ec 28             	sub    $0x28,%esp
    rb_node *x = node, *w, *root = tree->root->left;
c01007d7:	8b 45 0c             	mov    0xc(%ebp),%eax
c01007da:	89 45 ec             	mov    %eax,-0x14(%ebp)
c01007dd:	8b 45 08             	mov    0x8(%ebp),%eax
c01007e0:	8b 40 08             	mov    0x8(%eax),%eax
c01007e3:	8b 40 08             	mov    0x8(%eax),%eax
c01007e6:	89 45 f4             	mov    %eax,-0xc(%ebp)
            rb_##_left##_rotate(tree, x->parent);               \
            x = root;                                           \
        }                                                       \
    } while (0)

    while (x != root && !x->red) {
c01007e9:	e9 06 02 00 00       	jmp    c01009f4 <rb_delete_fixup+0x223>
        if (x == x->parent->left) {
c01007ee:	8b 45 ec             	mov    -0x14(%ebp),%eax
c01007f1:	8b 40 04             	mov    0x4(%eax),%eax
c01007f4:	8b 40 08             	mov    0x8(%eax),%eax
c01007f7:	3b 45 ec             	cmp    -0x14(%ebp),%eax
c01007fa:	0f 85 fe 00 00 00    	jne    c01008fe <rb_delete_fixup+0x12d>
            RB_DELETE_FIXUP_SUB(left, right);
c0100800:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0100803:	8b 40 04             	mov    0x4(%eax),%eax
c0100806:	8b 40 0c             	mov    0xc(%eax),%eax
c0100809:	89 45 f0             	mov    %eax,-0x10(%ebp)
c010080c:	8b 45 f0             	mov    -0x10(%ebp),%eax
c010080f:	8b 00                	mov    (%eax),%eax
c0100811:	85 c0                	test   %eax,%eax
c0100813:	74 36                	je     c010084b <rb_delete_fixup+0x7a>
c0100815:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0100818:	c7 00 00 00 00 00    	movl   $0x0,(%eax)
c010081e:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0100821:	8b 40 04             	mov    0x4(%eax),%eax
c0100824:	c7 00 01 00 00 00    	movl   $0x1,(%eax)
c010082a:	8b 45 ec             	mov    -0x14(%ebp),%eax
c010082d:	8b 40 04             	mov    0x4(%eax),%eax
c0100830:	89 44 24 04          	mov    %eax,0x4(%esp)
c0100834:	8b 45 08             	mov    0x8(%ebp),%eax
c0100837:	89 04 24             	mov    %eax,(%esp)
c010083a:	e8 a2 f9 ff ff       	call   c01001e1 <rb_left_rotate>
c010083f:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0100842:	8b 40 04             	mov    0x4(%eax),%eax
c0100845:	8b 40 0c             	mov    0xc(%eax),%eax
c0100848:	89 45 f0             	mov    %eax,-0x10(%ebp)
c010084b:	8b 45 f0             	mov    -0x10(%ebp),%eax
c010084e:	8b 40 08             	mov    0x8(%eax),%eax
c0100851:	8b 00                	mov    (%eax),%eax
c0100853:	85 c0                	test   %eax,%eax
c0100855:	75 23                	jne    c010087a <rb_delete_fixup+0xa9>
c0100857:	8b 45 f0             	mov    -0x10(%ebp),%eax
c010085a:	8b 40 0c             	mov    0xc(%eax),%eax
c010085d:	8b 00                	mov    (%eax),%eax
c010085f:	85 c0                	test   %eax,%eax
c0100861:	75 17                	jne    c010087a <rb_delete_fixup+0xa9>
c0100863:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0100866:	c7 00 01 00 00 00    	movl   $0x1,(%eax)
c010086c:	8b 45 ec             	mov    -0x14(%ebp),%eax
c010086f:	8b 40 04             	mov    0x4(%eax),%eax
c0100872:	89 45 ec             	mov    %eax,-0x14(%ebp)
c0100875:	e9 7a 01 00 00       	jmp    c01009f4 <rb_delete_fixup+0x223>
c010087a:	8b 45 f0             	mov    -0x10(%ebp),%eax
c010087d:	8b 40 0c             	mov    0xc(%eax),%eax
c0100880:	8b 00                	mov    (%eax),%eax
c0100882:	85 c0                	test   %eax,%eax
c0100884:	75 33                	jne    c01008b9 <rb_delete_fixup+0xe8>
c0100886:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0100889:	8b 40 08             	mov    0x8(%eax),%eax
c010088c:	c7 00 00 00 00 00    	movl   $0x0,(%eax)
c0100892:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0100895:	c7 00 01 00 00 00    	movl   $0x1,(%eax)
c010089b:	8b 45 f0             	mov    -0x10(%ebp),%eax
c010089e:	89 44 24 04          	mov    %eax,0x4(%esp)
c01008a2:	8b 45 08             	mov    0x8(%ebp),%eax
c01008a5:	89 04 24             	mov    %eax,(%esp)
c01008a8:	e8 23 fa ff ff       	call   c01002d0 <rb_right_rotate>
c01008ad:	8b 45 ec             	mov    -0x14(%ebp),%eax
c01008b0:	8b 40 04             	mov    0x4(%eax),%eax
c01008b3:	8b 40 0c             	mov    0xc(%eax),%eax
c01008b6:	89 45 f0             	mov    %eax,-0x10(%ebp)
c01008b9:	8b 45 ec             	mov    -0x14(%ebp),%eax
c01008bc:	8b 40 04             	mov    0x4(%eax),%eax
c01008bf:	8b 10                	mov    (%eax),%edx
c01008c1:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01008c4:	89 10                	mov    %edx,(%eax)
c01008c6:	8b 45 ec             	mov    -0x14(%ebp),%eax
c01008c9:	8b 40 04             	mov    0x4(%eax),%eax
c01008cc:	c7 00 00 00 00 00    	movl   $0x0,(%eax)
c01008d2:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01008d5:	8b 40 0c             	mov    0xc(%eax),%eax
c01008d8:	c7 00 00 00 00 00    	movl   $0x0,(%eax)
c01008de:	8b 45 ec             	mov    -0x14(%ebp),%eax
c01008e1:	8b 40 04             	mov    0x4(%eax),%eax
c01008e4:	89 44 24 04          	mov    %eax,0x4(%esp)
c01008e8:	8b 45 08             	mov    0x8(%ebp),%eax
c01008eb:	89 04 24             	mov    %eax,(%esp)
c01008ee:	e8 ee f8 ff ff       	call   c01001e1 <rb_left_rotate>
c01008f3:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01008f6:	89 45 ec             	mov    %eax,-0x14(%ebp)
c01008f9:	e9 f6 00 00 00       	jmp    c01009f4 <rb_delete_fixup+0x223>
        }
        else {
            RB_DELETE_FIXUP_SUB(right, left);
c01008fe:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0100901:	8b 40 04             	mov    0x4(%eax),%eax
c0100904:	8b 40 08             	mov    0x8(%eax),%eax
c0100907:	89 45 f0             	mov    %eax,-0x10(%ebp)
c010090a:	8b 45 f0             	mov    -0x10(%ebp),%eax
c010090d:	8b 00                	mov    (%eax),%eax
c010090f:	85 c0                	test   %eax,%eax
c0100911:	74 36                	je     c0100949 <rb_delete_fixup+0x178>
c0100913:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0100916:	c7 00 00 00 00 00    	movl   $0x0,(%eax)
c010091c:	8b 45 ec             	mov    -0x14(%ebp),%eax
c010091f:	8b 40 04             	mov    0x4(%eax),%eax
c0100922:	c7 00 01 00 00 00    	movl   $0x1,(%eax)
c0100928:	8b 45 ec             	mov    -0x14(%ebp),%eax
c010092b:	8b 40 04             	mov    0x4(%eax),%eax
c010092e:	89 44 24 04          	mov    %eax,0x4(%esp)
c0100932:	8b 45 08             	mov    0x8(%ebp),%eax
c0100935:	89 04 24             	mov    %eax,(%esp)
c0100938:	e8 93 f9 ff ff       	call   c01002d0 <rb_right_rotate>
c010093d:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0100940:	8b 40 04             	mov    0x4(%eax),%eax
c0100943:	8b 40 08             	mov    0x8(%eax),%eax
c0100946:	89 45 f0             	mov    %eax,-0x10(%ebp)
c0100949:	8b 45 f0             	mov    -0x10(%ebp),%eax
c010094c:	8b 40 0c             	mov    0xc(%eax),%eax
c010094f:	8b 00                	mov    (%eax),%eax
c0100951:	85 c0                	test   %eax,%eax
c0100953:	75 20                	jne    c0100975 <rb_delete_fixup+0x1a4>
c0100955:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0100958:	8b 40 08             	mov    0x8(%eax),%eax
c010095b:	8b 00                	mov    (%eax),%eax
c010095d:	85 c0                	test   %eax,%eax
c010095f:	75 14                	jne    c0100975 <rb_delete_fixup+0x1a4>
c0100961:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0100964:	c7 00 01 00 00 00    	movl   $0x1,(%eax)
c010096a:	8b 45 ec             	mov    -0x14(%ebp),%eax
c010096d:	8b 40 04             	mov    0x4(%eax),%eax
c0100970:	89 45 ec             	mov    %eax,-0x14(%ebp)
c0100973:	eb 7f                	jmp    c01009f4 <rb_delete_fixup+0x223>
c0100975:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0100978:	8b 40 08             	mov    0x8(%eax),%eax
c010097b:	8b 00                	mov    (%eax),%eax
c010097d:	85 c0                	test   %eax,%eax
c010097f:	75 33                	jne    c01009b4 <rb_delete_fixup+0x1e3>
c0100981:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0100984:	8b 40 0c             	mov    0xc(%eax),%eax
c0100987:	c7 00 00 00 00 00    	movl   $0x0,(%eax)
c010098d:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0100990:	c7 00 01 00 00 00    	movl   $0x1,(%eax)
c0100996:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0100999:	89 44 24 04          	mov    %eax,0x4(%esp)
c010099d:	8b 45 08             	mov    0x8(%ebp),%eax
c01009a0:	89 04 24             	mov    %eax,(%esp)
c01009a3:	e8 39 f8 ff ff       	call   c01001e1 <rb_left_rotate>
c01009a8:	8b 45 ec             	mov    -0x14(%ebp),%eax
c01009ab:	8b 40 04             	mov    0x4(%eax),%eax
c01009ae:	8b 40 08             	mov    0x8(%eax),%eax
c01009b1:	89 45 f0             	mov    %eax,-0x10(%ebp)
c01009b4:	8b 45 ec             	mov    -0x14(%ebp),%eax
c01009b7:	8b 40 04             	mov    0x4(%eax),%eax
c01009ba:	8b 10                	mov    (%eax),%edx
c01009bc:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01009bf:	89 10                	mov    %edx,(%eax)
c01009c1:	8b 45 ec             	mov    -0x14(%ebp),%eax
c01009c4:	8b 40 04             	mov    0x4(%eax),%eax
c01009c7:	c7 00 00 00 00 00    	movl   $0x0,(%eax)
c01009cd:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01009d0:	8b 40 08             	mov    0x8(%eax),%eax
c01009d3:	c7 00 00 00 00 00    	movl   $0x0,(%eax)
c01009d9:	8b 45 ec             	mov    -0x14(%ebp),%eax
c01009dc:	8b 40 04             	mov    0x4(%eax),%eax
c01009df:	89 44 24 04          	mov    %eax,0x4(%esp)
c01009e3:	8b 45 08             	mov    0x8(%ebp),%eax
c01009e6:	89 04 24             	mov    %eax,(%esp)
c01009e9:	e8 e2 f8 ff ff       	call   c01002d0 <rb_right_rotate>
c01009ee:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01009f1:	89 45 ec             	mov    %eax,-0x14(%ebp)
            rb_##_left##_rotate(tree, x->parent);               \
            x = root;                                           \
        }                                                       \
    } while (0)

    while (x != root && !x->red) {
c01009f4:	8b 45 ec             	mov    -0x14(%ebp),%eax
c01009f7:	3b 45 f4             	cmp    -0xc(%ebp),%eax
c01009fa:	74 0d                	je     c0100a09 <rb_delete_fixup+0x238>
c01009fc:	8b 45 ec             	mov    -0x14(%ebp),%eax
c01009ff:	8b 00                	mov    (%eax),%eax
c0100a01:	85 c0                	test   %eax,%eax
c0100a03:	0f 84 e5 fd ff ff    	je     c01007ee <rb_delete_fixup+0x1d>
        }
        else {
            RB_DELETE_FIXUP_SUB(right, left);
        }
    }
    x->red = 0;
c0100a09:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0100a0c:	c7 00 00 00 00 00    	movl   $0x0,(%eax)

#undef RB_DELETE_FIXUP_SUB
}
c0100a12:	c9                   	leave  
c0100a13:	c3                   	ret    

c0100a14 <rb_delete>:
/* *
 * rb_delete - deletes @node from @tree, and calls rb_delete_fixup to
 * restore red-black properties.
 * */
void
rb_delete(rb_tree *tree, rb_node *node) {
c0100a14:	55                   	push   %ebp
c0100a15:	89 e5                	mov    %esp,%ebp
c0100a17:	83 ec 38             	sub    $0x38,%esp
    rb_node *x, *y, *z = node;
c0100a1a:	8b 45 0c             	mov    0xc(%ebp),%eax
c0100a1d:	89 45 e8             	mov    %eax,-0x18(%ebp)
    rb_node *nil = tree->nil, *root = tree->root;
c0100a20:	8b 45 08             	mov    0x8(%ebp),%eax
c0100a23:	8b 40 04             	mov    0x4(%eax),%eax
c0100a26:	89 45 ec             	mov    %eax,-0x14(%ebp)
c0100a29:	8b 45 08             	mov    0x8(%ebp),%eax
c0100a2c:	8b 40 08             	mov    0x8(%eax),%eax
c0100a2f:	89 45 f0             	mov    %eax,-0x10(%ebp)

    y = (z->left == nil || z->right == nil) ? z : rb_tree_successor(tree, z);
c0100a32:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0100a35:	8b 40 08             	mov    0x8(%eax),%eax
c0100a38:	3b 45 ec             	cmp    -0x14(%ebp),%eax
c0100a3b:	74 1f                	je     c0100a5c <rb_delete+0x48>
c0100a3d:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0100a40:	8b 40 0c             	mov    0xc(%eax),%eax
c0100a43:	3b 45 ec             	cmp    -0x14(%ebp),%eax
c0100a46:	74 14                	je     c0100a5c <rb_delete+0x48>
c0100a48:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0100a4b:	89 44 24 04          	mov    %eax,0x4(%esp)
c0100a4f:	8b 45 08             	mov    0x8(%ebp),%eax
c0100a52:	89 04 24             	mov    %eax,(%esp)
c0100a55:	e8 16 fc ff ff       	call   c0100670 <rb_tree_successor>
c0100a5a:	eb 03                	jmp    c0100a5f <rb_delete+0x4b>
c0100a5c:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0100a5f:	89 45 e4             	mov    %eax,-0x1c(%ebp)
    x = (y->left != nil) ? y->left : y->right;
c0100a62:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0100a65:	8b 40 08             	mov    0x8(%eax),%eax
c0100a68:	3b 45 ec             	cmp    -0x14(%ebp),%eax
c0100a6b:	74 08                	je     c0100a75 <rb_delete+0x61>
c0100a6d:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0100a70:	8b 40 08             	mov    0x8(%eax),%eax
c0100a73:	eb 06                	jmp    c0100a7b <rb_delete+0x67>
c0100a75:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0100a78:	8b 40 0c             	mov    0xc(%eax),%eax
c0100a7b:	89 45 e0             	mov    %eax,-0x20(%ebp)

    assert(y != root && y != nil);
c0100a7e:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0100a81:	3b 45 f0             	cmp    -0x10(%ebp),%eax
c0100a84:	74 08                	je     c0100a8e <rb_delete+0x7a>
c0100a86:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0100a89:	3b 45 ec             	cmp    -0x14(%ebp),%eax
c0100a8c:	75 24                	jne    c0100ab2 <rb_delete+0x9e>
c0100a8e:	c7 44 24 0c 9c ae 10 	movl   $0xc010ae9c,0xc(%esp)
c0100a95:	c0 
c0100a96:	c7 44 24 08 14 ae 10 	movl   $0xc010ae14,0x8(%esp)
c0100a9d:	c0 
c0100a9e:	c7 44 24 04 2f 01 00 	movl   $0x12f,0x4(%esp)
c0100aa5:	00 
c0100aa6:	c7 04 24 29 ae 10 c0 	movl   $0xc010ae29,(%esp)
c0100aad:	e8 fe 1f 00 00       	call   c0102ab0 <__panic>

    x->parent = y->parent;
c0100ab2:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0100ab5:	8b 50 04             	mov    0x4(%eax),%edx
c0100ab8:	8b 45 e0             	mov    -0x20(%ebp),%eax
c0100abb:	89 50 04             	mov    %edx,0x4(%eax)
    if (y == y->parent->left) {
c0100abe:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0100ac1:	8b 40 04             	mov    0x4(%eax),%eax
c0100ac4:	8b 40 08             	mov    0x8(%eax),%eax
c0100ac7:	3b 45 e4             	cmp    -0x1c(%ebp),%eax
c0100aca:	75 0e                	jne    c0100ada <rb_delete+0xc6>
        y->parent->left = x;
c0100acc:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0100acf:	8b 40 04             	mov    0x4(%eax),%eax
c0100ad2:	8b 55 e0             	mov    -0x20(%ebp),%edx
c0100ad5:	89 50 08             	mov    %edx,0x8(%eax)
c0100ad8:	eb 0c                	jmp    c0100ae6 <rb_delete+0xd2>
    }
    else {
        y->parent->right = x;
c0100ada:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0100add:	8b 40 04             	mov    0x4(%eax),%eax
c0100ae0:	8b 55 e0             	mov    -0x20(%ebp),%edx
c0100ae3:	89 50 0c             	mov    %edx,0xc(%eax)
    }

    bool need_fixup = !(y->red);
c0100ae6:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0100ae9:	8b 00                	mov    (%eax),%eax
c0100aeb:	85 c0                	test   %eax,%eax
c0100aed:	0f 94 c0             	sete   %al
c0100af0:	0f b6 c0             	movzbl %al,%eax
c0100af3:	89 45 f4             	mov    %eax,-0xc(%ebp)

    if (y != z) {
c0100af6:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0100af9:	3b 45 e8             	cmp    -0x18(%ebp),%eax
c0100afc:	74 5c                	je     c0100b5a <rb_delete+0x146>
        if (z == z->parent->left) {
c0100afe:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0100b01:	8b 40 04             	mov    0x4(%eax),%eax
c0100b04:	8b 40 08             	mov    0x8(%eax),%eax
c0100b07:	3b 45 e8             	cmp    -0x18(%ebp),%eax
c0100b0a:	75 0e                	jne    c0100b1a <rb_delete+0x106>
            z->parent->left = y;
c0100b0c:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0100b0f:	8b 40 04             	mov    0x4(%eax),%eax
c0100b12:	8b 55 e4             	mov    -0x1c(%ebp),%edx
c0100b15:	89 50 08             	mov    %edx,0x8(%eax)
c0100b18:	eb 0c                	jmp    c0100b26 <rb_delete+0x112>
        }
        else {
            z->parent->right = y;
c0100b1a:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0100b1d:	8b 40 04             	mov    0x4(%eax),%eax
c0100b20:	8b 55 e4             	mov    -0x1c(%ebp),%edx
c0100b23:	89 50 0c             	mov    %edx,0xc(%eax)
        }
        z->left->parent = z->right->parent = y;
c0100b26:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0100b29:	8b 50 08             	mov    0x8(%eax),%edx
c0100b2c:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0100b2f:	8b 40 0c             	mov    0xc(%eax),%eax
c0100b32:	8b 4d e4             	mov    -0x1c(%ebp),%ecx
c0100b35:	89 48 04             	mov    %ecx,0x4(%eax)
c0100b38:	8b 40 04             	mov    0x4(%eax),%eax
c0100b3b:	89 42 04             	mov    %eax,0x4(%edx)
        *y = *z;
c0100b3e:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0100b41:	8b 55 e8             	mov    -0x18(%ebp),%edx
c0100b44:	8b 0a                	mov    (%edx),%ecx
c0100b46:	89 08                	mov    %ecx,(%eax)
c0100b48:	8b 4a 04             	mov    0x4(%edx),%ecx
c0100b4b:	89 48 04             	mov    %ecx,0x4(%eax)
c0100b4e:	8b 4a 08             	mov    0x8(%edx),%ecx
c0100b51:	89 48 08             	mov    %ecx,0x8(%eax)
c0100b54:	8b 52 0c             	mov    0xc(%edx),%edx
c0100b57:	89 50 0c             	mov    %edx,0xc(%eax)
    }
    if (need_fixup) {
c0100b5a:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c0100b5e:	74 12                	je     c0100b72 <rb_delete+0x15e>
        rb_delete_fixup(tree, x);
c0100b60:	8b 45 e0             	mov    -0x20(%ebp),%eax
c0100b63:	89 44 24 04          	mov    %eax,0x4(%esp)
c0100b67:	8b 45 08             	mov    0x8(%ebp),%eax
c0100b6a:	89 04 24             	mov    %eax,(%esp)
c0100b6d:	e8 5f fc ff ff       	call   c01007d1 <rb_delete_fixup>
    }
}
c0100b72:	c9                   	leave  
c0100b73:	c3                   	ret    

c0100b74 <rb_tree_destroy>:

/* rb_tree_destroy - destroy a tree and free memory */
void
rb_tree_destroy(rb_tree *tree) {
c0100b74:	55                   	push   %ebp
c0100b75:	89 e5                	mov    %esp,%ebp
c0100b77:	83 ec 18             	sub    $0x18,%esp
    kfree(tree->root);
c0100b7a:	8b 45 08             	mov    0x8(%ebp),%eax
c0100b7d:	8b 40 08             	mov    0x8(%eax),%eax
c0100b80:	89 04 24             	mov    %eax,(%esp)
c0100b83:	e8 dc 78 00 00       	call   c0108464 <kfree>
    kfree(tree->nil);
c0100b88:	8b 45 08             	mov    0x8(%ebp),%eax
c0100b8b:	8b 40 04             	mov    0x4(%eax),%eax
c0100b8e:	89 04 24             	mov    %eax,(%esp)
c0100b91:	e8 ce 78 00 00       	call   c0108464 <kfree>
    kfree(tree);
c0100b96:	8b 45 08             	mov    0x8(%ebp),%eax
c0100b99:	89 04 24             	mov    %eax,(%esp)
c0100b9c:	e8 c3 78 00 00       	call   c0108464 <kfree>
}
c0100ba1:	c9                   	leave  
c0100ba2:	c3                   	ret    

c0100ba3 <rb_node_prev>:
/* *
 * rb_node_prev - returns the predecessor node of @node in @tree,
 * or 'NULL' if no predecessor exists.
 * */
rb_node *
rb_node_prev(rb_tree *tree, rb_node *node) {
c0100ba3:	55                   	push   %ebp
c0100ba4:	89 e5                	mov    %esp,%ebp
c0100ba6:	83 ec 18             	sub    $0x18,%esp
    rb_node *prev = rb_tree_predecessor(tree, node);
c0100ba9:	8b 45 0c             	mov    0xc(%ebp),%eax
c0100bac:	89 44 24 04          	mov    %eax,0x4(%esp)
c0100bb0:	8b 45 08             	mov    0x8(%ebp),%eax
c0100bb3:	89 04 24             	mov    %eax,(%esp)
c0100bb6:	e8 30 fb ff ff       	call   c01006eb <rb_tree_predecessor>
c0100bbb:	89 45 fc             	mov    %eax,-0x4(%ebp)
    return (prev != tree->nil) ? prev : NULL;
c0100bbe:	8b 45 08             	mov    0x8(%ebp),%eax
c0100bc1:	8b 40 04             	mov    0x4(%eax),%eax
c0100bc4:	3b 45 fc             	cmp    -0x4(%ebp),%eax
c0100bc7:	74 05                	je     c0100bce <rb_node_prev+0x2b>
c0100bc9:	8b 45 fc             	mov    -0x4(%ebp),%eax
c0100bcc:	eb 05                	jmp    c0100bd3 <rb_node_prev+0x30>
c0100bce:	b8 00 00 00 00       	mov    $0x0,%eax
}
c0100bd3:	c9                   	leave  
c0100bd4:	c3                   	ret    

c0100bd5 <rb_node_next>:
/* *
 * rb_node_next - returns the successor node of @node in @tree,
 * or 'NULL' if no successor exists.
 * */
rb_node *
rb_node_next(rb_tree *tree, rb_node *node) {
c0100bd5:	55                   	push   %ebp
c0100bd6:	89 e5                	mov    %esp,%ebp
c0100bd8:	83 ec 18             	sub    $0x18,%esp
    rb_node *next = rb_tree_successor(tree, node);
c0100bdb:	8b 45 0c             	mov    0xc(%ebp),%eax
c0100bde:	89 44 24 04          	mov    %eax,0x4(%esp)
c0100be2:	8b 45 08             	mov    0x8(%ebp),%eax
c0100be5:	89 04 24             	mov    %eax,(%esp)
c0100be8:	e8 83 fa ff ff       	call   c0100670 <rb_tree_successor>
c0100bed:	89 45 fc             	mov    %eax,-0x4(%ebp)
    return (next != tree->nil) ? next : NULL;
c0100bf0:	8b 45 08             	mov    0x8(%ebp),%eax
c0100bf3:	8b 40 04             	mov    0x4(%eax),%eax
c0100bf6:	3b 45 fc             	cmp    -0x4(%ebp),%eax
c0100bf9:	74 05                	je     c0100c00 <rb_node_next+0x2b>
c0100bfb:	8b 45 fc             	mov    -0x4(%ebp),%eax
c0100bfe:	eb 05                	jmp    c0100c05 <rb_node_next+0x30>
c0100c00:	b8 00 00 00 00       	mov    $0x0,%eax
}
c0100c05:	c9                   	leave  
c0100c06:	c3                   	ret    

c0100c07 <rb_node_root>:

/* rb_node_root - returns the root node of a @tree, or 'NULL' if tree is empty */
rb_node *
rb_node_root(rb_tree *tree) {
c0100c07:	55                   	push   %ebp
c0100c08:	89 e5                	mov    %esp,%ebp
c0100c0a:	83 ec 10             	sub    $0x10,%esp
    rb_node *node = tree->root->left;
c0100c0d:	8b 45 08             	mov    0x8(%ebp),%eax
c0100c10:	8b 40 08             	mov    0x8(%eax),%eax
c0100c13:	8b 40 08             	mov    0x8(%eax),%eax
c0100c16:	89 45 fc             	mov    %eax,-0x4(%ebp)
    return (node != tree->nil) ? node : NULL;
c0100c19:	8b 45 08             	mov    0x8(%ebp),%eax
c0100c1c:	8b 40 04             	mov    0x4(%eax),%eax
c0100c1f:	3b 45 fc             	cmp    -0x4(%ebp),%eax
c0100c22:	74 05                	je     c0100c29 <rb_node_root+0x22>
c0100c24:	8b 45 fc             	mov    -0x4(%ebp),%eax
c0100c27:	eb 05                	jmp    c0100c2e <rb_node_root+0x27>
c0100c29:	b8 00 00 00 00       	mov    $0x0,%eax
}
c0100c2e:	c9                   	leave  
c0100c2f:	c3                   	ret    

c0100c30 <rb_node_left>:

/* rb_node_left - gets the left child of @node, or 'NULL' if no such node */
rb_node *
rb_node_left(rb_tree *tree, rb_node *node) {
c0100c30:	55                   	push   %ebp
c0100c31:	89 e5                	mov    %esp,%ebp
c0100c33:	83 ec 10             	sub    $0x10,%esp
    rb_node *left = node->left;
c0100c36:	8b 45 0c             	mov    0xc(%ebp),%eax
c0100c39:	8b 40 08             	mov    0x8(%eax),%eax
c0100c3c:	89 45 fc             	mov    %eax,-0x4(%ebp)
    return (left != tree->nil) ? left : NULL;
c0100c3f:	8b 45 08             	mov    0x8(%ebp),%eax
c0100c42:	8b 40 04             	mov    0x4(%eax),%eax
c0100c45:	3b 45 fc             	cmp    -0x4(%ebp),%eax
c0100c48:	74 05                	je     c0100c4f <rb_node_left+0x1f>
c0100c4a:	8b 45 fc             	mov    -0x4(%ebp),%eax
c0100c4d:	eb 05                	jmp    c0100c54 <rb_node_left+0x24>
c0100c4f:	b8 00 00 00 00       	mov    $0x0,%eax
}
c0100c54:	c9                   	leave  
c0100c55:	c3                   	ret    

c0100c56 <rb_node_right>:

/* rb_node_right - gets the right child of @node, or 'NULL' if no such node */
rb_node *
rb_node_right(rb_tree *tree, rb_node *node) {
c0100c56:	55                   	push   %ebp
c0100c57:	89 e5                	mov    %esp,%ebp
c0100c59:	83 ec 10             	sub    $0x10,%esp
    rb_node *right = node->right;
c0100c5c:	8b 45 0c             	mov    0xc(%ebp),%eax
c0100c5f:	8b 40 0c             	mov    0xc(%eax),%eax
c0100c62:	89 45 fc             	mov    %eax,-0x4(%ebp)
    return (right != tree->nil) ? right : NULL;
c0100c65:	8b 45 08             	mov    0x8(%ebp),%eax
c0100c68:	8b 40 04             	mov    0x4(%eax),%eax
c0100c6b:	3b 45 fc             	cmp    -0x4(%ebp),%eax
c0100c6e:	74 05                	je     c0100c75 <rb_node_right+0x1f>
c0100c70:	8b 45 fc             	mov    -0x4(%ebp),%eax
c0100c73:	eb 05                	jmp    c0100c7a <rb_node_right+0x24>
c0100c75:	b8 00 00 00 00       	mov    $0x0,%eax
}
c0100c7a:	c9                   	leave  
c0100c7b:	c3                   	ret    

c0100c7c <check_tree>:

int
check_tree(rb_tree *tree, rb_node *node) {
c0100c7c:	55                   	push   %ebp
c0100c7d:	89 e5                	mov    %esp,%ebp
c0100c7f:	83 ec 28             	sub    $0x28,%esp
    rb_node *nil = tree->nil;
c0100c82:	8b 45 08             	mov    0x8(%ebp),%eax
c0100c85:	8b 40 04             	mov    0x4(%eax),%eax
c0100c88:	89 45 e8             	mov    %eax,-0x18(%ebp)
    if (node == nil) {
c0100c8b:	8b 45 0c             	mov    0xc(%ebp),%eax
c0100c8e:	3b 45 e8             	cmp    -0x18(%ebp),%eax
c0100c91:	75 37                	jne    c0100cca <check_tree+0x4e>
        assert(!node->red);
c0100c93:	8b 45 0c             	mov    0xc(%ebp),%eax
c0100c96:	8b 00                	mov    (%eax),%eax
c0100c98:	85 c0                	test   %eax,%eax
c0100c9a:	74 24                	je     c0100cc0 <check_tree+0x44>
c0100c9c:	c7 44 24 0c b2 ae 10 	movl   $0xc010aeb2,0xc(%esp)
c0100ca3:	c0 
c0100ca4:	c7 44 24 08 14 ae 10 	movl   $0xc010ae14,0x8(%esp)
c0100cab:	c0 
c0100cac:	c7 44 24 04 7f 01 00 	movl   $0x17f,0x4(%esp)
c0100cb3:	00 
c0100cb4:	c7 04 24 29 ae 10 c0 	movl   $0xc010ae29,(%esp)
c0100cbb:	e8 f0 1d 00 00       	call   c0102ab0 <__panic>
        return 1;
c0100cc0:	b8 01 00 00 00       	mov    $0x1,%eax
c0100cc5:	e9 af 01 00 00       	jmp    c0100e79 <check_tree+0x1fd>
    }
    if (node->left != nil) {
c0100cca:	8b 45 0c             	mov    0xc(%ebp),%eax
c0100ccd:	8b 40 08             	mov    0x8(%eax),%eax
c0100cd0:	3b 45 e8             	cmp    -0x18(%ebp),%eax
c0100cd3:	74 71                	je     c0100d46 <check_tree+0xca>
        assert(COMPARE(tree, node, node->left) >= 0);
c0100cd5:	8b 45 08             	mov    0x8(%ebp),%eax
c0100cd8:	8b 10                	mov    (%eax),%edx
c0100cda:	8b 45 0c             	mov    0xc(%ebp),%eax
c0100cdd:	8b 40 08             	mov    0x8(%eax),%eax
c0100ce0:	89 44 24 04          	mov    %eax,0x4(%esp)
c0100ce4:	8b 45 0c             	mov    0xc(%ebp),%eax
c0100ce7:	89 04 24             	mov    %eax,(%esp)
c0100cea:	ff d2                	call   *%edx
c0100cec:	85 c0                	test   %eax,%eax
c0100cee:	79 24                	jns    c0100d14 <check_tree+0x98>
c0100cf0:	c7 44 24 0c c0 ae 10 	movl   $0xc010aec0,0xc(%esp)
c0100cf7:	c0 
c0100cf8:	c7 44 24 08 14 ae 10 	movl   $0xc010ae14,0x8(%esp)
c0100cff:	c0 
c0100d00:	c7 44 24 04 83 01 00 	movl   $0x183,0x4(%esp)
c0100d07:	00 
c0100d08:	c7 04 24 29 ae 10 c0 	movl   $0xc010ae29,(%esp)
c0100d0f:	e8 9c 1d 00 00       	call   c0102ab0 <__panic>
        assert(node->left->parent == node);
c0100d14:	8b 45 0c             	mov    0xc(%ebp),%eax
c0100d17:	8b 40 08             	mov    0x8(%eax),%eax
c0100d1a:	8b 40 04             	mov    0x4(%eax),%eax
c0100d1d:	3b 45 0c             	cmp    0xc(%ebp),%eax
c0100d20:	74 24                	je     c0100d46 <check_tree+0xca>
c0100d22:	c7 44 24 0c e5 ae 10 	movl   $0xc010aee5,0xc(%esp)
c0100d29:	c0 
c0100d2a:	c7 44 24 08 14 ae 10 	movl   $0xc010ae14,0x8(%esp)
c0100d31:	c0 
c0100d32:	c7 44 24 04 84 01 00 	movl   $0x184,0x4(%esp)
c0100d39:	00 
c0100d3a:	c7 04 24 29 ae 10 c0 	movl   $0xc010ae29,(%esp)
c0100d41:	e8 6a 1d 00 00       	call   c0102ab0 <__panic>
    }
    if (node->right != nil) {
c0100d46:	8b 45 0c             	mov    0xc(%ebp),%eax
c0100d49:	8b 40 0c             	mov    0xc(%eax),%eax
c0100d4c:	3b 45 e8             	cmp    -0x18(%ebp),%eax
c0100d4f:	74 71                	je     c0100dc2 <check_tree+0x146>
        assert(COMPARE(tree, node, node->right) <= 0);
c0100d51:	8b 45 08             	mov    0x8(%ebp),%eax
c0100d54:	8b 10                	mov    (%eax),%edx
c0100d56:	8b 45 0c             	mov    0xc(%ebp),%eax
c0100d59:	8b 40 0c             	mov    0xc(%eax),%eax
c0100d5c:	89 44 24 04          	mov    %eax,0x4(%esp)
c0100d60:	8b 45 0c             	mov    0xc(%ebp),%eax
c0100d63:	89 04 24             	mov    %eax,(%esp)
c0100d66:	ff d2                	call   *%edx
c0100d68:	85 c0                	test   %eax,%eax
c0100d6a:	7e 24                	jle    c0100d90 <check_tree+0x114>
c0100d6c:	c7 44 24 0c 00 af 10 	movl   $0xc010af00,0xc(%esp)
c0100d73:	c0 
c0100d74:	c7 44 24 08 14 ae 10 	movl   $0xc010ae14,0x8(%esp)
c0100d7b:	c0 
c0100d7c:	c7 44 24 04 87 01 00 	movl   $0x187,0x4(%esp)
c0100d83:	00 
c0100d84:	c7 04 24 29 ae 10 c0 	movl   $0xc010ae29,(%esp)
c0100d8b:	e8 20 1d 00 00       	call   c0102ab0 <__panic>
        assert(node->right->parent == node);
c0100d90:	8b 45 0c             	mov    0xc(%ebp),%eax
c0100d93:	8b 40 0c             	mov    0xc(%eax),%eax
c0100d96:	8b 40 04             	mov    0x4(%eax),%eax
c0100d99:	3b 45 0c             	cmp    0xc(%ebp),%eax
c0100d9c:	74 24                	je     c0100dc2 <check_tree+0x146>
c0100d9e:	c7 44 24 0c 26 af 10 	movl   $0xc010af26,0xc(%esp)
c0100da5:	c0 
c0100da6:	c7 44 24 08 14 ae 10 	movl   $0xc010ae14,0x8(%esp)
c0100dad:	c0 
c0100dae:	c7 44 24 04 88 01 00 	movl   $0x188,0x4(%esp)
c0100db5:	00 
c0100db6:	c7 04 24 29 ae 10 c0 	movl   $0xc010ae29,(%esp)
c0100dbd:	e8 ee 1c 00 00       	call   c0102ab0 <__panic>
    }
    if (node->red) {
c0100dc2:	8b 45 0c             	mov    0xc(%ebp),%eax
c0100dc5:	8b 00                	mov    (%eax),%eax
c0100dc7:	85 c0                	test   %eax,%eax
c0100dc9:	74 3c                	je     c0100e07 <check_tree+0x18b>
        assert(!node->left->red && !node->right->red);
c0100dcb:	8b 45 0c             	mov    0xc(%ebp),%eax
c0100dce:	8b 40 08             	mov    0x8(%eax),%eax
c0100dd1:	8b 00                	mov    (%eax),%eax
c0100dd3:	85 c0                	test   %eax,%eax
c0100dd5:	75 0c                	jne    c0100de3 <check_tree+0x167>
c0100dd7:	8b 45 0c             	mov    0xc(%ebp),%eax
c0100dda:	8b 40 0c             	mov    0xc(%eax),%eax
c0100ddd:	8b 00                	mov    (%eax),%eax
c0100ddf:	85 c0                	test   %eax,%eax
c0100de1:	74 24                	je     c0100e07 <check_tree+0x18b>
c0100de3:	c7 44 24 0c 44 af 10 	movl   $0xc010af44,0xc(%esp)
c0100dea:	c0 
c0100deb:	c7 44 24 08 14 ae 10 	movl   $0xc010ae14,0x8(%esp)
c0100df2:	c0 
c0100df3:	c7 44 24 04 8b 01 00 	movl   $0x18b,0x4(%esp)
c0100dfa:	00 
c0100dfb:	c7 04 24 29 ae 10 c0 	movl   $0xc010ae29,(%esp)
c0100e02:	e8 a9 1c 00 00       	call   c0102ab0 <__panic>
    }
    int hb_left = check_tree(tree, node->left);
c0100e07:	8b 45 0c             	mov    0xc(%ebp),%eax
c0100e0a:	8b 40 08             	mov    0x8(%eax),%eax
c0100e0d:	89 44 24 04          	mov    %eax,0x4(%esp)
c0100e11:	8b 45 08             	mov    0x8(%ebp),%eax
c0100e14:	89 04 24             	mov    %eax,(%esp)
c0100e17:	e8 60 fe ff ff       	call   c0100c7c <check_tree>
c0100e1c:	89 45 ec             	mov    %eax,-0x14(%ebp)
    int hb_right = check_tree(tree, node->right);
c0100e1f:	8b 45 0c             	mov    0xc(%ebp),%eax
c0100e22:	8b 40 0c             	mov    0xc(%eax),%eax
c0100e25:	89 44 24 04          	mov    %eax,0x4(%esp)
c0100e29:	8b 45 08             	mov    0x8(%ebp),%eax
c0100e2c:	89 04 24             	mov    %eax,(%esp)
c0100e2f:	e8 48 fe ff ff       	call   c0100c7c <check_tree>
c0100e34:	89 45 f0             	mov    %eax,-0x10(%ebp)
    assert(hb_left == hb_right);
c0100e37:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0100e3a:	3b 45 f0             	cmp    -0x10(%ebp),%eax
c0100e3d:	74 24                	je     c0100e63 <check_tree+0x1e7>
c0100e3f:	c7 44 24 0c 6a af 10 	movl   $0xc010af6a,0xc(%esp)
c0100e46:	c0 
c0100e47:	c7 44 24 08 14 ae 10 	movl   $0xc010ae14,0x8(%esp)
c0100e4e:	c0 
c0100e4f:	c7 44 24 04 8f 01 00 	movl   $0x18f,0x4(%esp)
c0100e56:	00 
c0100e57:	c7 04 24 29 ae 10 c0 	movl   $0xc010ae29,(%esp)
c0100e5e:	e8 4d 1c 00 00       	call   c0102ab0 <__panic>
    int hb = hb_left;
c0100e63:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0100e66:	89 45 f4             	mov    %eax,-0xc(%ebp)
    if (!node->red) {
c0100e69:	8b 45 0c             	mov    0xc(%ebp),%eax
c0100e6c:	8b 00                	mov    (%eax),%eax
c0100e6e:	85 c0                	test   %eax,%eax
c0100e70:	75 04                	jne    c0100e76 <check_tree+0x1fa>
        hb ++;
c0100e72:	83 45 f4 01          	addl   $0x1,-0xc(%ebp)
    }
    return hb;
c0100e76:	8b 45 f4             	mov    -0xc(%ebp),%eax
}
c0100e79:	c9                   	leave  
c0100e7a:	c3                   	ret    

c0100e7b <check_safe_kmalloc>:

static void *
check_safe_kmalloc(size_t size) {
c0100e7b:	55                   	push   %ebp
c0100e7c:	89 e5                	mov    %esp,%ebp
c0100e7e:	83 ec 28             	sub    $0x28,%esp
    void *ret = kmalloc(size);
c0100e81:	8b 45 08             	mov    0x8(%ebp),%eax
c0100e84:	89 04 24             	mov    %eax,(%esp)
c0100e87:	e8 a9 72 00 00       	call   c0108135 <kmalloc>
c0100e8c:	89 45 f4             	mov    %eax,-0xc(%ebp)
    assert(ret != NULL);
c0100e8f:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c0100e93:	75 24                	jne    c0100eb9 <check_safe_kmalloc+0x3e>
c0100e95:	c7 44 24 0c 7e af 10 	movl   $0xc010af7e,0xc(%esp)
c0100e9c:	c0 
c0100e9d:	c7 44 24 08 14 ae 10 	movl   $0xc010ae14,0x8(%esp)
c0100ea4:	c0 
c0100ea5:	c7 44 24 04 9a 01 00 	movl   $0x19a,0x4(%esp)
c0100eac:	00 
c0100ead:	c7 04 24 29 ae 10 c0 	movl   $0xc010ae29,(%esp)
c0100eb4:	e8 f7 1b 00 00       	call   c0102ab0 <__panic>
    return ret;
c0100eb9:	8b 45 f4             	mov    -0xc(%ebp),%eax
}
c0100ebc:	c9                   	leave  
c0100ebd:	c3                   	ret    

c0100ebe <check_compare1>:

#define rbn2data(node)              \
    (to_struct(node, struct check_data, rb_link))

static inline int
check_compare1(rb_node *node1, rb_node *node2) {
c0100ebe:	55                   	push   %ebp
c0100ebf:	89 e5                	mov    %esp,%ebp
    return rbn2data(node1)->data - rbn2data(node2)->data;
c0100ec1:	8b 45 08             	mov    0x8(%ebp),%eax
c0100ec4:	83 e8 04             	sub    $0x4,%eax
c0100ec7:	8b 10                	mov    (%eax),%edx
c0100ec9:	8b 45 0c             	mov    0xc(%ebp),%eax
c0100ecc:	83 e8 04             	sub    $0x4,%eax
c0100ecf:	8b 00                	mov    (%eax),%eax
c0100ed1:	89 d1                	mov    %edx,%ecx
c0100ed3:	29 c1                	sub    %eax,%ecx
c0100ed5:	89 c8                	mov    %ecx,%eax
}
c0100ed7:	5d                   	pop    %ebp
c0100ed8:	c3                   	ret    

c0100ed9 <check_compare2>:

static inline int
check_compare2(rb_node *node, void *key) {
c0100ed9:	55                   	push   %ebp
c0100eda:	89 e5                	mov    %esp,%ebp
    return rbn2data(node)->data - (long)key;
c0100edc:	8b 45 08             	mov    0x8(%ebp),%eax
c0100edf:	83 e8 04             	sub    $0x4,%eax
c0100ee2:	8b 10                	mov    (%eax),%edx
c0100ee4:	8b 45 0c             	mov    0xc(%ebp),%eax
c0100ee7:	89 d1                	mov    %edx,%ecx
c0100ee9:	29 c1                	sub    %eax,%ecx
c0100eeb:	89 c8                	mov    %ecx,%eax
}
c0100eed:	5d                   	pop    %ebp
c0100eee:	c3                   	ret    

c0100eef <check_rb_tree>:

void
check_rb_tree(void) {
c0100eef:	55                   	push   %ebp
c0100ef0:	89 e5                	mov    %esp,%ebp
c0100ef2:	53                   	push   %ebx
c0100ef3:	83 ec 44             	sub    $0x44,%esp
    rb_tree *tree = rb_tree_create(check_compare1);
c0100ef6:	c7 04 24 be 0e 10 c0 	movl   $0xc0100ebe,(%esp)
c0100efd:	e8 df f1 ff ff       	call   c01000e1 <rb_tree_create>
c0100f02:	89 45 cc             	mov    %eax,-0x34(%ebp)
    assert(tree != NULL);
c0100f05:	83 7d cc 00          	cmpl   $0x0,-0x34(%ebp)
c0100f09:	75 24                	jne    c0100f2f <check_rb_tree+0x40>
c0100f0b:	c7 44 24 0c 8a af 10 	movl   $0xc010af8a,0xc(%esp)
c0100f12:	c0 
c0100f13:	c7 44 24 08 14 ae 10 	movl   $0xc010ae14,0x8(%esp)
c0100f1a:	c0 
c0100f1b:	c7 44 24 04 b3 01 00 	movl   $0x1b3,0x4(%esp)
c0100f22:	00 
c0100f23:	c7 04 24 29 ae 10 c0 	movl   $0xc010ae29,(%esp)
c0100f2a:	e8 81 1b 00 00       	call   c0102ab0 <__panic>

    rb_node *nil = tree->nil, *root = tree->root;
c0100f2f:	8b 45 cc             	mov    -0x34(%ebp),%eax
c0100f32:	8b 40 04             	mov    0x4(%eax),%eax
c0100f35:	89 45 d0             	mov    %eax,-0x30(%ebp)
c0100f38:	8b 45 cc             	mov    -0x34(%ebp),%eax
c0100f3b:	8b 40 08             	mov    0x8(%eax),%eax
c0100f3e:	89 45 d4             	mov    %eax,-0x2c(%ebp)
    assert(!nil->red && root->left == nil);
c0100f41:	8b 45 d0             	mov    -0x30(%ebp),%eax
c0100f44:	8b 00                	mov    (%eax),%eax
c0100f46:	85 c0                	test   %eax,%eax
c0100f48:	75 0b                	jne    c0100f55 <check_rb_tree+0x66>
c0100f4a:	8b 45 d4             	mov    -0x2c(%ebp),%eax
c0100f4d:	8b 40 08             	mov    0x8(%eax),%eax
c0100f50:	3b 45 d0             	cmp    -0x30(%ebp),%eax
c0100f53:	74 24                	je     c0100f79 <check_rb_tree+0x8a>
c0100f55:	c7 44 24 0c 98 af 10 	movl   $0xc010af98,0xc(%esp)
c0100f5c:	c0 
c0100f5d:	c7 44 24 08 14 ae 10 	movl   $0xc010ae14,0x8(%esp)
c0100f64:	c0 
c0100f65:	c7 44 24 04 b6 01 00 	movl   $0x1b6,0x4(%esp)
c0100f6c:	00 
c0100f6d:	c7 04 24 29 ae 10 c0 	movl   $0xc010ae29,(%esp)
c0100f74:	e8 37 1b 00 00       	call   c0102ab0 <__panic>

    int total = 1000;
c0100f79:	c7 45 d8 e8 03 00 00 	movl   $0x3e8,-0x28(%ebp)
    struct check_data **all = check_safe_kmalloc(sizeof(struct check_data *) * total);
c0100f80:	8b 45 d8             	mov    -0x28(%ebp),%eax
c0100f83:	c1 e0 02             	shl    $0x2,%eax
c0100f86:	89 04 24             	mov    %eax,(%esp)
c0100f89:	e8 ed fe ff ff       	call   c0100e7b <check_safe_kmalloc>
c0100f8e:	89 45 dc             	mov    %eax,-0x24(%ebp)

    long i;
    for (i = 0; i < total; i ++) {
c0100f91:	c7 45 e0 00 00 00 00 	movl   $0x0,-0x20(%ebp)
c0100f98:	eb 2d                	jmp    c0100fc7 <check_rb_tree+0xd8>
        all[i] = check_safe_kmalloc(sizeof(struct check_data));
c0100f9a:	8b 45 e0             	mov    -0x20(%ebp),%eax
c0100f9d:	c1 e0 02             	shl    $0x2,%eax
c0100fa0:	89 c3                	mov    %eax,%ebx
c0100fa2:	03 5d dc             	add    -0x24(%ebp),%ebx
c0100fa5:	c7 04 24 14 00 00 00 	movl   $0x14,(%esp)
c0100fac:	e8 ca fe ff ff       	call   c0100e7b <check_safe_kmalloc>
c0100fb1:	89 03                	mov    %eax,(%ebx)
        all[i]->data = i;
c0100fb3:	8b 45 e0             	mov    -0x20(%ebp),%eax
c0100fb6:	c1 e0 02             	shl    $0x2,%eax
c0100fb9:	03 45 dc             	add    -0x24(%ebp),%eax
c0100fbc:	8b 00                	mov    (%eax),%eax
c0100fbe:	8b 55 e0             	mov    -0x20(%ebp),%edx
c0100fc1:	89 10                	mov    %edx,(%eax)

    int total = 1000;
    struct check_data **all = check_safe_kmalloc(sizeof(struct check_data *) * total);

    long i;
    for (i = 0; i < total; i ++) {
c0100fc3:	83 45 e0 01          	addl   $0x1,-0x20(%ebp)
c0100fc7:	8b 45 e0             	mov    -0x20(%ebp),%eax
c0100fca:	3b 45 d8             	cmp    -0x28(%ebp),%eax
c0100fcd:	7c cb                	jl     c0100f9a <check_rb_tree+0xab>
        all[i] = check_safe_kmalloc(sizeof(struct check_data));
        all[i]->data = i;
    }

    int *mark = check_safe_kmalloc(sizeof(int) * total);
c0100fcf:	8b 45 d8             	mov    -0x28(%ebp),%eax
c0100fd2:	c1 e0 02             	shl    $0x2,%eax
c0100fd5:	89 04 24             	mov    %eax,(%esp)
c0100fd8:	e8 9e fe ff ff       	call   c0100e7b <check_safe_kmalloc>
c0100fdd:	89 45 e4             	mov    %eax,-0x1c(%ebp)
    memset(mark, 0, sizeof(int) * total);
c0100fe0:	8b 45 d8             	mov    -0x28(%ebp),%eax
c0100fe3:	c1 e0 02             	shl    $0x2,%eax
c0100fe6:	89 44 24 08          	mov    %eax,0x8(%esp)
c0100fea:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
c0100ff1:	00 
c0100ff2:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0100ff5:	89 04 24             	mov    %eax,(%esp)
c0100ff8:	e8 46 9c 00 00       	call   c010ac43 <memset>

    for (i = 0; i < total; i ++) {
c0100ffd:	c7 45 e0 00 00 00 00 	movl   $0x0,-0x20(%ebp)
c0101004:	eb 1d                	jmp    c0101023 <check_rb_tree+0x134>
        mark[all[i]->data] = 1;
c0101006:	8b 45 e0             	mov    -0x20(%ebp),%eax
c0101009:	c1 e0 02             	shl    $0x2,%eax
c010100c:	03 45 dc             	add    -0x24(%ebp),%eax
c010100f:	8b 00                	mov    (%eax),%eax
c0101011:	8b 00                	mov    (%eax),%eax
c0101013:	c1 e0 02             	shl    $0x2,%eax
c0101016:	03 45 e4             	add    -0x1c(%ebp),%eax
c0101019:	c7 00 01 00 00 00    	movl   $0x1,(%eax)
    }

    int *mark = check_safe_kmalloc(sizeof(int) * total);
    memset(mark, 0, sizeof(int) * total);

    for (i = 0; i < total; i ++) {
c010101f:	83 45 e0 01          	addl   $0x1,-0x20(%ebp)
c0101023:	8b 45 e0             	mov    -0x20(%ebp),%eax
c0101026:	3b 45 d8             	cmp    -0x28(%ebp),%eax
c0101029:	7c db                	jl     c0101006 <check_rb_tree+0x117>
        mark[all[i]->data] = 1;
    }
    for (i = 0; i < total; i ++) {
c010102b:	c7 45 e0 00 00 00 00 	movl   $0x0,-0x20(%ebp)
c0101032:	eb 38                	jmp    c010106c <check_rb_tree+0x17d>
        assert(mark[i] == 1);
c0101034:	8b 45 e0             	mov    -0x20(%ebp),%eax
c0101037:	c1 e0 02             	shl    $0x2,%eax
c010103a:	03 45 e4             	add    -0x1c(%ebp),%eax
c010103d:	8b 00                	mov    (%eax),%eax
c010103f:	83 f8 01             	cmp    $0x1,%eax
c0101042:	74 24                	je     c0101068 <check_rb_tree+0x179>
c0101044:	c7 44 24 0c b7 af 10 	movl   $0xc010afb7,0xc(%esp)
c010104b:	c0 
c010104c:	c7 44 24 08 14 ae 10 	movl   $0xc010ae14,0x8(%esp)
c0101053:	c0 
c0101054:	c7 44 24 04 c8 01 00 	movl   $0x1c8,0x4(%esp)
c010105b:	00 
c010105c:	c7 04 24 29 ae 10 c0 	movl   $0xc010ae29,(%esp)
c0101063:	e8 48 1a 00 00       	call   c0102ab0 <__panic>
    memset(mark, 0, sizeof(int) * total);

    for (i = 0; i < total; i ++) {
        mark[all[i]->data] = 1;
    }
    for (i = 0; i < total; i ++) {
c0101068:	83 45 e0 01          	addl   $0x1,-0x20(%ebp)
c010106c:	8b 45 e0             	mov    -0x20(%ebp),%eax
c010106f:	3b 45 d8             	cmp    -0x28(%ebp),%eax
c0101072:	7c c0                	jl     c0101034 <check_rb_tree+0x145>
        assert(mark[i] == 1);
    }

    for (i = 0; i < total; i ++) {
c0101074:	c7 45 e0 00 00 00 00 	movl   $0x0,-0x20(%ebp)
c010107b:	eb 52                	jmp    c01010cf <check_rb_tree+0x1e0>
        int j = (rand() % (total - i)) + i;
c010107d:	e8 b6 97 00 00       	call   c010a838 <rand>
c0101082:	8b 55 e0             	mov    -0x20(%ebp),%edx
c0101085:	8b 4d d8             	mov    -0x28(%ebp),%ecx
c0101088:	29 d1                	sub    %edx,%ecx
c010108a:	89 c2                	mov    %eax,%edx
c010108c:	c1 fa 1f             	sar    $0x1f,%edx
c010108f:	f7 f9                	idiv   %ecx
c0101091:	89 d0                	mov    %edx,%eax
c0101093:	03 45 e0             	add    -0x20(%ebp),%eax
c0101096:	89 45 f0             	mov    %eax,-0x10(%ebp)
        struct check_data *z = all[i];
c0101099:	8b 45 e0             	mov    -0x20(%ebp),%eax
c010109c:	c1 e0 02             	shl    $0x2,%eax
c010109f:	03 45 dc             	add    -0x24(%ebp),%eax
c01010a2:	8b 00                	mov    (%eax),%eax
c01010a4:	89 45 f4             	mov    %eax,-0xc(%ebp)
        all[i] = all[j];
c01010a7:	8b 45 e0             	mov    -0x20(%ebp),%eax
c01010aa:	c1 e0 02             	shl    $0x2,%eax
c01010ad:	03 45 dc             	add    -0x24(%ebp),%eax
c01010b0:	8b 55 f0             	mov    -0x10(%ebp),%edx
c01010b3:	c1 e2 02             	shl    $0x2,%edx
c01010b6:	03 55 dc             	add    -0x24(%ebp),%edx
c01010b9:	8b 12                	mov    (%edx),%edx
c01010bb:	89 10                	mov    %edx,(%eax)
        all[j] = z;
c01010bd:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01010c0:	c1 e0 02             	shl    $0x2,%eax
c01010c3:	03 45 dc             	add    -0x24(%ebp),%eax
c01010c6:	8b 55 f4             	mov    -0xc(%ebp),%edx
c01010c9:	89 10                	mov    %edx,(%eax)
    }
    for (i = 0; i < total; i ++) {
        assert(mark[i] == 1);
    }

    for (i = 0; i < total; i ++) {
c01010cb:	83 45 e0 01          	addl   $0x1,-0x20(%ebp)
c01010cf:	8b 45 e0             	mov    -0x20(%ebp),%eax
c01010d2:	3b 45 d8             	cmp    -0x28(%ebp),%eax
c01010d5:	7c a6                	jl     c010107d <check_rb_tree+0x18e>
        struct check_data *z = all[i];
        all[i] = all[j];
        all[j] = z;
    }

    memset(mark, 0, sizeof(int) * total);
c01010d7:	8b 45 d8             	mov    -0x28(%ebp),%eax
c01010da:	c1 e0 02             	shl    $0x2,%eax
c01010dd:	89 44 24 08          	mov    %eax,0x8(%esp)
c01010e1:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
c01010e8:	00 
c01010e9:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c01010ec:	89 04 24             	mov    %eax,(%esp)
c01010ef:	e8 4f 9b 00 00       	call   c010ac43 <memset>
    for (i = 0; i < total; i ++) {
c01010f4:	c7 45 e0 00 00 00 00 	movl   $0x0,-0x20(%ebp)
c01010fb:	eb 1d                	jmp    c010111a <check_rb_tree+0x22b>
        mark[all[i]->data] = 1;
c01010fd:	8b 45 e0             	mov    -0x20(%ebp),%eax
c0101100:	c1 e0 02             	shl    $0x2,%eax
c0101103:	03 45 dc             	add    -0x24(%ebp),%eax
c0101106:	8b 00                	mov    (%eax),%eax
c0101108:	8b 00                	mov    (%eax),%eax
c010110a:	c1 e0 02             	shl    $0x2,%eax
c010110d:	03 45 e4             	add    -0x1c(%ebp),%eax
c0101110:	c7 00 01 00 00 00    	movl   $0x1,(%eax)
        all[i] = all[j];
        all[j] = z;
    }

    memset(mark, 0, sizeof(int) * total);
    for (i = 0; i < total; i ++) {
c0101116:	83 45 e0 01          	addl   $0x1,-0x20(%ebp)
c010111a:	8b 45 e0             	mov    -0x20(%ebp),%eax
c010111d:	3b 45 d8             	cmp    -0x28(%ebp),%eax
c0101120:	7c db                	jl     c01010fd <check_rb_tree+0x20e>
        mark[all[i]->data] = 1;
    }
    for (i = 0; i < total; i ++) {
c0101122:	c7 45 e0 00 00 00 00 	movl   $0x0,-0x20(%ebp)
c0101129:	eb 38                	jmp    c0101163 <check_rb_tree+0x274>
        assert(mark[i] == 1);
c010112b:	8b 45 e0             	mov    -0x20(%ebp),%eax
c010112e:	c1 e0 02             	shl    $0x2,%eax
c0101131:	03 45 e4             	add    -0x1c(%ebp),%eax
c0101134:	8b 00                	mov    (%eax),%eax
c0101136:	83 f8 01             	cmp    $0x1,%eax
c0101139:	74 24                	je     c010115f <check_rb_tree+0x270>
c010113b:	c7 44 24 0c b7 af 10 	movl   $0xc010afb7,0xc(%esp)
c0101142:	c0 
c0101143:	c7 44 24 08 14 ae 10 	movl   $0xc010ae14,0x8(%esp)
c010114a:	c0 
c010114b:	c7 44 24 04 d7 01 00 	movl   $0x1d7,0x4(%esp)
c0101152:	00 
c0101153:	c7 04 24 29 ae 10 c0 	movl   $0xc010ae29,(%esp)
c010115a:	e8 51 19 00 00       	call   c0102ab0 <__panic>

    memset(mark, 0, sizeof(int) * total);
    for (i = 0; i < total; i ++) {
        mark[all[i]->data] = 1;
    }
    for (i = 0; i < total; i ++) {
c010115f:	83 45 e0 01          	addl   $0x1,-0x20(%ebp)
c0101163:	8b 45 e0             	mov    -0x20(%ebp),%eax
c0101166:	3b 45 d8             	cmp    -0x28(%ebp),%eax
c0101169:	7c c0                	jl     c010112b <check_rb_tree+0x23c>
        assert(mark[i] == 1);
    }

    for (i = 0; i < total; i ++) {
c010116b:	c7 45 e0 00 00 00 00 	movl   $0x0,-0x20(%ebp)
c0101172:	eb 36                	jmp    c01011aa <check_rb_tree+0x2bb>
        rb_insert(tree, &(all[i]->rb_link));
c0101174:	8b 45 e0             	mov    -0x20(%ebp),%eax
c0101177:	c1 e0 02             	shl    $0x2,%eax
c010117a:	03 45 dc             	add    -0x24(%ebp),%eax
c010117d:	8b 00                	mov    (%eax),%eax
c010117f:	83 c0 04             	add    $0x4,%eax
c0101182:	89 44 24 04          	mov    %eax,0x4(%esp)
c0101186:	8b 45 cc             	mov    -0x34(%ebp),%eax
c0101189:	89 04 24             	mov    %eax,(%esp)
c010118c:	e8 e8 f2 ff ff       	call   c0100479 <rb_insert>
        check_tree(tree, root->left);
c0101191:	8b 45 d4             	mov    -0x2c(%ebp),%eax
c0101194:	8b 40 08             	mov    0x8(%eax),%eax
c0101197:	89 44 24 04          	mov    %eax,0x4(%esp)
c010119b:	8b 45 cc             	mov    -0x34(%ebp),%eax
c010119e:	89 04 24             	mov    %eax,(%esp)
c01011a1:	e8 d6 fa ff ff       	call   c0100c7c <check_tree>
    }
    for (i = 0; i < total; i ++) {
        assert(mark[i] == 1);
    }

    for (i = 0; i < total; i ++) {
c01011a6:	83 45 e0 01          	addl   $0x1,-0x20(%ebp)
c01011aa:	8b 45 e0             	mov    -0x20(%ebp),%eax
c01011ad:	3b 45 d8             	cmp    -0x28(%ebp),%eax
c01011b0:	7c c2                	jl     c0101174 <check_rb_tree+0x285>
        rb_insert(tree, &(all[i]->rb_link));
        check_tree(tree, root->left);
    }

    rb_node *node;
    for (i = 0; i < total; i ++) {
c01011b2:	c7 45 e0 00 00 00 00 	movl   $0x0,-0x20(%ebp)
c01011b9:	eb 68                	jmp    c0101223 <check_rb_tree+0x334>
        node = rb_search(tree, check_compare2, (void *)(all[i]->data));
c01011bb:	8b 45 e0             	mov    -0x20(%ebp),%eax
c01011be:	c1 e0 02             	shl    $0x2,%eax
c01011c1:	03 45 dc             	add    -0x24(%ebp),%eax
c01011c4:	8b 00                	mov    (%eax),%eax
c01011c6:	8b 00                	mov    (%eax),%eax
c01011c8:	89 44 24 08          	mov    %eax,0x8(%esp)
c01011cc:	c7 44 24 04 d9 0e 10 	movl   $0xc0100ed9,0x4(%esp)
c01011d3:	c0 
c01011d4:	8b 45 cc             	mov    -0x34(%ebp),%eax
c01011d7:	89 04 24             	mov    %eax,(%esp)
c01011da:	e8 87 f5 ff ff       	call   c0100766 <rb_search>
c01011df:	89 45 e8             	mov    %eax,-0x18(%ebp)
        assert(node != NULL && node == &(all[i]->rb_link));
c01011e2:	83 7d e8 00          	cmpl   $0x0,-0x18(%ebp)
c01011e6:	74 13                	je     c01011fb <check_rb_tree+0x30c>
c01011e8:	8b 45 e0             	mov    -0x20(%ebp),%eax
c01011eb:	c1 e0 02             	shl    $0x2,%eax
c01011ee:	03 45 dc             	add    -0x24(%ebp),%eax
c01011f1:	8b 00                	mov    (%eax),%eax
c01011f3:	83 c0 04             	add    $0x4,%eax
c01011f6:	3b 45 e8             	cmp    -0x18(%ebp),%eax
c01011f9:	74 24                	je     c010121f <check_rb_tree+0x330>
c01011fb:	c7 44 24 0c c4 af 10 	movl   $0xc010afc4,0xc(%esp)
c0101202:	c0 
c0101203:	c7 44 24 08 14 ae 10 	movl   $0xc010ae14,0x8(%esp)
c010120a:	c0 
c010120b:	c7 44 24 04 e2 01 00 	movl   $0x1e2,0x4(%esp)
c0101212:	00 
c0101213:	c7 04 24 29 ae 10 c0 	movl   $0xc010ae29,(%esp)
c010121a:	e8 91 18 00 00       	call   c0102ab0 <__panic>
        rb_insert(tree, &(all[i]->rb_link));
        check_tree(tree, root->left);
    }

    rb_node *node;
    for (i = 0; i < total; i ++) {
c010121f:	83 45 e0 01          	addl   $0x1,-0x20(%ebp)
c0101223:	8b 45 e0             	mov    -0x20(%ebp),%eax
c0101226:	3b 45 d8             	cmp    -0x28(%ebp),%eax
c0101229:	7c 90                	jl     c01011bb <check_rb_tree+0x2cc>
        node = rb_search(tree, check_compare2, (void *)(all[i]->data));
        assert(node != NULL && node == &(all[i]->rb_link));
    }

    for (i = 0; i < total; i ++) {
c010122b:	c7 45 e0 00 00 00 00 	movl   $0x0,-0x20(%ebp)
c0101232:	eb 7f                	jmp    c01012b3 <check_rb_tree+0x3c4>
        node = rb_search(tree, check_compare2, (void *)i);
c0101234:	8b 45 e0             	mov    -0x20(%ebp),%eax
c0101237:	89 44 24 08          	mov    %eax,0x8(%esp)
c010123b:	c7 44 24 04 d9 0e 10 	movl   $0xc0100ed9,0x4(%esp)
c0101242:	c0 
c0101243:	8b 45 cc             	mov    -0x34(%ebp),%eax
c0101246:	89 04 24             	mov    %eax,(%esp)
c0101249:	e8 18 f5 ff ff       	call   c0100766 <rb_search>
c010124e:	89 45 e8             	mov    %eax,-0x18(%ebp)
        assert(node != NULL && rbn2data(node)->data == i);
c0101251:	83 7d e8 00          	cmpl   $0x0,-0x18(%ebp)
c0101255:	74 0d                	je     c0101264 <check_rb_tree+0x375>
c0101257:	8b 45 e8             	mov    -0x18(%ebp),%eax
c010125a:	83 e8 04             	sub    $0x4,%eax
c010125d:	8b 00                	mov    (%eax),%eax
c010125f:	3b 45 e0             	cmp    -0x20(%ebp),%eax
c0101262:	74 24                	je     c0101288 <check_rb_tree+0x399>
c0101264:	c7 44 24 0c f0 af 10 	movl   $0xc010aff0,0xc(%esp)
c010126b:	c0 
c010126c:	c7 44 24 08 14 ae 10 	movl   $0xc010ae14,0x8(%esp)
c0101273:	c0 
c0101274:	c7 44 24 04 e7 01 00 	movl   $0x1e7,0x4(%esp)
c010127b:	00 
c010127c:	c7 04 24 29 ae 10 c0 	movl   $0xc010ae29,(%esp)
c0101283:	e8 28 18 00 00       	call   c0102ab0 <__panic>
        rb_delete(tree, node);
c0101288:	8b 45 e8             	mov    -0x18(%ebp),%eax
c010128b:	89 44 24 04          	mov    %eax,0x4(%esp)
c010128f:	8b 45 cc             	mov    -0x34(%ebp),%eax
c0101292:	89 04 24             	mov    %eax,(%esp)
c0101295:	e8 7a f7 ff ff       	call   c0100a14 <rb_delete>
        check_tree(tree, root->left);
c010129a:	8b 45 d4             	mov    -0x2c(%ebp),%eax
c010129d:	8b 40 08             	mov    0x8(%eax),%eax
c01012a0:	89 44 24 04          	mov    %eax,0x4(%esp)
c01012a4:	8b 45 cc             	mov    -0x34(%ebp),%eax
c01012a7:	89 04 24             	mov    %eax,(%esp)
c01012aa:	e8 cd f9 ff ff       	call   c0100c7c <check_tree>
    for (i = 0; i < total; i ++) {
        node = rb_search(tree, check_compare2, (void *)(all[i]->data));
        assert(node != NULL && node == &(all[i]->rb_link));
    }

    for (i = 0; i < total; i ++) {
c01012af:	83 45 e0 01          	addl   $0x1,-0x20(%ebp)
c01012b3:	8b 45 e0             	mov    -0x20(%ebp),%eax
c01012b6:	3b 45 d8             	cmp    -0x28(%ebp),%eax
c01012b9:	0f 8c 75 ff ff ff    	jl     c0101234 <check_rb_tree+0x345>
        assert(node != NULL && rbn2data(node)->data == i);
        rb_delete(tree, node);
        check_tree(tree, root->left);
    }

    assert(!nil->red && root->left == nil);
c01012bf:	8b 45 d0             	mov    -0x30(%ebp),%eax
c01012c2:	8b 00                	mov    (%eax),%eax
c01012c4:	85 c0                	test   %eax,%eax
c01012c6:	75 0b                	jne    c01012d3 <check_rb_tree+0x3e4>
c01012c8:	8b 45 d4             	mov    -0x2c(%ebp),%eax
c01012cb:	8b 40 08             	mov    0x8(%eax),%eax
c01012ce:	3b 45 d0             	cmp    -0x30(%ebp),%eax
c01012d1:	74 24                	je     c01012f7 <check_rb_tree+0x408>
c01012d3:	c7 44 24 0c 98 af 10 	movl   $0xc010af98,0xc(%esp)
c01012da:	c0 
c01012db:	c7 44 24 08 14 ae 10 	movl   $0xc010ae14,0x8(%esp)
c01012e2:	c0 
c01012e3:	c7 44 24 04 ec 01 00 	movl   $0x1ec,0x4(%esp)
c01012ea:	00 
c01012eb:	c7 04 24 29 ae 10 c0 	movl   $0xc010ae29,(%esp)
c01012f2:	e8 b9 17 00 00       	call   c0102ab0 <__panic>

    long max = 32;
c01012f7:	c7 45 ec 20 00 00 00 	movl   $0x20,-0x14(%ebp)
    if (max > total) {
c01012fe:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0101301:	3b 45 d8             	cmp    -0x28(%ebp),%eax
c0101304:	7e 06                	jle    c010130c <check_rb_tree+0x41d>
        max = total;
c0101306:	8b 45 d8             	mov    -0x28(%ebp),%eax
c0101309:	89 45 ec             	mov    %eax,-0x14(%ebp)
    }

    for (i = 0; i < max; i ++) {
c010130c:	c7 45 e0 00 00 00 00 	movl   $0x0,-0x20(%ebp)
c0101313:	eb 46                	jmp    c010135b <check_rb_tree+0x46c>
        all[i]->data = max;
c0101315:	8b 45 e0             	mov    -0x20(%ebp),%eax
c0101318:	c1 e0 02             	shl    $0x2,%eax
c010131b:	03 45 dc             	add    -0x24(%ebp),%eax
c010131e:	8b 00                	mov    (%eax),%eax
c0101320:	8b 55 ec             	mov    -0x14(%ebp),%edx
c0101323:	89 10                	mov    %edx,(%eax)
        rb_insert(tree, &(all[i]->rb_link));
c0101325:	8b 45 e0             	mov    -0x20(%ebp),%eax
c0101328:	c1 e0 02             	shl    $0x2,%eax
c010132b:	03 45 dc             	add    -0x24(%ebp),%eax
c010132e:	8b 00                	mov    (%eax),%eax
c0101330:	83 c0 04             	add    $0x4,%eax
c0101333:	89 44 24 04          	mov    %eax,0x4(%esp)
c0101337:	8b 45 cc             	mov    -0x34(%ebp),%eax
c010133a:	89 04 24             	mov    %eax,(%esp)
c010133d:	e8 37 f1 ff ff       	call   c0100479 <rb_insert>
        check_tree(tree, root->left);
c0101342:	8b 45 d4             	mov    -0x2c(%ebp),%eax
c0101345:	8b 40 08             	mov    0x8(%eax),%eax
c0101348:	89 44 24 04          	mov    %eax,0x4(%esp)
c010134c:	8b 45 cc             	mov    -0x34(%ebp),%eax
c010134f:	89 04 24             	mov    %eax,(%esp)
c0101352:	e8 25 f9 ff ff       	call   c0100c7c <check_tree>
    long max = 32;
    if (max > total) {
        max = total;
    }

    for (i = 0; i < max; i ++) {
c0101357:	83 45 e0 01          	addl   $0x1,-0x20(%ebp)
c010135b:	8b 45 e0             	mov    -0x20(%ebp),%eax
c010135e:	3b 45 ec             	cmp    -0x14(%ebp),%eax
c0101361:	7c b2                	jl     c0101315 <check_rb_tree+0x426>
        all[i]->data = max;
        rb_insert(tree, &(all[i]->rb_link));
        check_tree(tree, root->left);
    }

    for (i = 0; i < max; i ++) {
c0101363:	c7 45 e0 00 00 00 00 	movl   $0x0,-0x20(%ebp)
c010136a:	eb 7f                	jmp    c01013eb <check_rb_tree+0x4fc>
        node = rb_search(tree, check_compare2, (void *)max);
c010136c:	8b 45 ec             	mov    -0x14(%ebp),%eax
c010136f:	89 44 24 08          	mov    %eax,0x8(%esp)
c0101373:	c7 44 24 04 d9 0e 10 	movl   $0xc0100ed9,0x4(%esp)
c010137a:	c0 
c010137b:	8b 45 cc             	mov    -0x34(%ebp),%eax
c010137e:	89 04 24             	mov    %eax,(%esp)
c0101381:	e8 e0 f3 ff ff       	call   c0100766 <rb_search>
c0101386:	89 45 e8             	mov    %eax,-0x18(%ebp)
        assert(node != NULL && rbn2data(node)->data == max);
c0101389:	83 7d e8 00          	cmpl   $0x0,-0x18(%ebp)
c010138d:	74 0d                	je     c010139c <check_rb_tree+0x4ad>
c010138f:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0101392:	83 e8 04             	sub    $0x4,%eax
c0101395:	8b 00                	mov    (%eax),%eax
c0101397:	3b 45 ec             	cmp    -0x14(%ebp),%eax
c010139a:	74 24                	je     c01013c0 <check_rb_tree+0x4d1>
c010139c:	c7 44 24 0c 1c b0 10 	movl   $0xc010b01c,0xc(%esp)
c01013a3:	c0 
c01013a4:	c7 44 24 08 14 ae 10 	movl   $0xc010ae14,0x8(%esp)
c01013ab:	c0 
c01013ac:	c7 44 24 04 fb 01 00 	movl   $0x1fb,0x4(%esp)
c01013b3:	00 
c01013b4:	c7 04 24 29 ae 10 c0 	movl   $0xc010ae29,(%esp)
c01013bb:	e8 f0 16 00 00       	call   c0102ab0 <__panic>
        rb_delete(tree, node);
c01013c0:	8b 45 e8             	mov    -0x18(%ebp),%eax
c01013c3:	89 44 24 04          	mov    %eax,0x4(%esp)
c01013c7:	8b 45 cc             	mov    -0x34(%ebp),%eax
c01013ca:	89 04 24             	mov    %eax,(%esp)
c01013cd:	e8 42 f6 ff ff       	call   c0100a14 <rb_delete>
        check_tree(tree, root->left);
c01013d2:	8b 45 d4             	mov    -0x2c(%ebp),%eax
c01013d5:	8b 40 08             	mov    0x8(%eax),%eax
c01013d8:	89 44 24 04          	mov    %eax,0x4(%esp)
c01013dc:	8b 45 cc             	mov    -0x34(%ebp),%eax
c01013df:	89 04 24             	mov    %eax,(%esp)
c01013e2:	e8 95 f8 ff ff       	call   c0100c7c <check_tree>
        all[i]->data = max;
        rb_insert(tree, &(all[i]->rb_link));
        check_tree(tree, root->left);
    }

    for (i = 0; i < max; i ++) {
c01013e7:	83 45 e0 01          	addl   $0x1,-0x20(%ebp)
c01013eb:	8b 45 e0             	mov    -0x20(%ebp),%eax
c01013ee:	3b 45 ec             	cmp    -0x14(%ebp),%eax
c01013f1:	0f 8c 75 ff ff ff    	jl     c010136c <check_rb_tree+0x47d>
        assert(node != NULL && rbn2data(node)->data == max);
        rb_delete(tree, node);
        check_tree(tree, root->left);
    }

    assert(rb_tree_empty(tree));
c01013f7:	8b 45 cc             	mov    -0x34(%ebp),%eax
c01013fa:	89 04 24             	mov    %eax,(%esp)
c01013fd:	e8 b6 ec ff ff       	call   c01000b8 <rb_tree_empty>
c0101402:	85 c0                	test   %eax,%eax
c0101404:	75 24                	jne    c010142a <check_rb_tree+0x53b>
c0101406:	c7 44 24 0c 48 b0 10 	movl   $0xc010b048,0xc(%esp)
c010140d:	c0 
c010140e:	c7 44 24 08 14 ae 10 	movl   $0xc010ae14,0x8(%esp)
c0101415:	c0 
c0101416:	c7 44 24 04 00 02 00 	movl   $0x200,0x4(%esp)
c010141d:	00 
c010141e:	c7 04 24 29 ae 10 c0 	movl   $0xc010ae29,(%esp)
c0101425:	e8 86 16 00 00       	call   c0102ab0 <__panic>

    for (i = 0; i < total; i ++) {
c010142a:	c7 45 e0 00 00 00 00 	movl   $0x0,-0x20(%ebp)
c0101431:	eb 36                	jmp    c0101469 <check_rb_tree+0x57a>
        rb_insert(tree, &(all[i]->rb_link));
c0101433:	8b 45 e0             	mov    -0x20(%ebp),%eax
c0101436:	c1 e0 02             	shl    $0x2,%eax
c0101439:	03 45 dc             	add    -0x24(%ebp),%eax
c010143c:	8b 00                	mov    (%eax),%eax
c010143e:	83 c0 04             	add    $0x4,%eax
c0101441:	89 44 24 04          	mov    %eax,0x4(%esp)
c0101445:	8b 45 cc             	mov    -0x34(%ebp),%eax
c0101448:	89 04 24             	mov    %eax,(%esp)
c010144b:	e8 29 f0 ff ff       	call   c0100479 <rb_insert>
        check_tree(tree, root->left);
c0101450:	8b 45 d4             	mov    -0x2c(%ebp),%eax
c0101453:	8b 40 08             	mov    0x8(%eax),%eax
c0101456:	89 44 24 04          	mov    %eax,0x4(%esp)
c010145a:	8b 45 cc             	mov    -0x34(%ebp),%eax
c010145d:	89 04 24             	mov    %eax,(%esp)
c0101460:	e8 17 f8 ff ff       	call   c0100c7c <check_tree>
        check_tree(tree, root->left);
    }

    assert(rb_tree_empty(tree));

    for (i = 0; i < total; i ++) {
c0101465:	83 45 e0 01          	addl   $0x1,-0x20(%ebp)
c0101469:	8b 45 e0             	mov    -0x20(%ebp),%eax
c010146c:	3b 45 d8             	cmp    -0x28(%ebp),%eax
c010146f:	7c c2                	jl     c0101433 <check_rb_tree+0x544>
        rb_insert(tree, &(all[i]->rb_link));
        check_tree(tree, root->left);
    }

    rb_tree_destroy(tree);
c0101471:	8b 45 cc             	mov    -0x34(%ebp),%eax
c0101474:	89 04 24             	mov    %eax,(%esp)
c0101477:	e8 f8 f6 ff ff       	call   c0100b74 <rb_tree_destroy>

    for (i = 0; i < total; i ++) {
c010147c:	c7 45 e0 00 00 00 00 	movl   $0x0,-0x20(%ebp)
c0101483:	eb 17                	jmp    c010149c <check_rb_tree+0x5ad>
        kfree(all[i]);
c0101485:	8b 45 e0             	mov    -0x20(%ebp),%eax
c0101488:	c1 e0 02             	shl    $0x2,%eax
c010148b:	03 45 dc             	add    -0x24(%ebp),%eax
c010148e:	8b 00                	mov    (%eax),%eax
c0101490:	89 04 24             	mov    %eax,(%esp)
c0101493:	e8 cc 6f 00 00       	call   c0108464 <kfree>
        check_tree(tree, root->left);
    }

    rb_tree_destroy(tree);

    for (i = 0; i < total; i ++) {
c0101498:	83 45 e0 01          	addl   $0x1,-0x20(%ebp)
c010149c:	8b 45 e0             	mov    -0x20(%ebp),%eax
c010149f:	3b 45 d8             	cmp    -0x28(%ebp),%eax
c01014a2:	7c e1                	jl     c0101485 <check_rb_tree+0x596>
        kfree(all[i]);
    }

    kfree(mark);
c01014a4:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c01014a7:	89 04 24             	mov    %eax,(%esp)
c01014aa:	e8 b5 6f 00 00       	call   c0108464 <kfree>
    kfree(all);
c01014af:	8b 45 dc             	mov    -0x24(%ebp),%eax
c01014b2:	89 04 24             	mov    %eax,(%esp)
c01014b5:	e8 aa 6f 00 00       	call   c0108464 <kfree>
}
c01014ba:	83 c4 44             	add    $0x44,%esp
c01014bd:	5b                   	pop    %ebx
c01014be:	5d                   	pop    %ebp
c01014bf:	c3                   	ret    

c01014c0 <readline>:
 * The readline() function returns the text of the line read. If some errors
 * are happened, NULL is returned. The return value is a global variable,
 * thus it should be copied before it is used.
 * */
char *
readline(const char *prompt) {
c01014c0:	55                   	push   %ebp
c01014c1:	89 e5                	mov    %esp,%ebp
c01014c3:	83 ec 28             	sub    $0x28,%esp
    if (prompt != NULL) {
c01014c6:	83 7d 08 00          	cmpl   $0x0,0x8(%ebp)
c01014ca:	74 13                	je     c01014df <readline+0x1f>
        cprintf("%s", prompt);
c01014cc:	8b 45 08             	mov    0x8(%ebp),%eax
c01014cf:	89 44 24 04          	mov    %eax,0x4(%esp)
c01014d3:	c7 04 24 5c b0 10 c0 	movl   $0xc010b05c,(%esp)
c01014da:	e8 ed 00 00 00       	call   c01015cc <cprintf>
    }
    int i = 0, c;
c01014df:	c7 45 f0 00 00 00 00 	movl   $0x0,-0x10(%ebp)
c01014e6:	eb 01                	jmp    c01014e9 <readline+0x29>
        else if (c == '\n' || c == '\r') {
            cputchar(c);
            buf[i] = '\0';
            return buf;
        }
    }
c01014e8:	90                   	nop
    if (prompt != NULL) {
        cprintf("%s", prompt);
    }
    int i = 0, c;
    while (1) {
        c = getchar();
c01014e9:	e8 69 01 00 00       	call   c0101657 <getchar>
c01014ee:	89 45 f4             	mov    %eax,-0xc(%ebp)
        if (c < 0) {
c01014f1:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c01014f5:	79 07                	jns    c01014fe <readline+0x3e>
            return NULL;
c01014f7:	b8 00 00 00 00       	mov    $0x0,%eax
c01014fc:	eb 76                	jmp    c0101574 <readline+0xb4>
        }
        else if (c >= ' ' && i < BUFSIZE - 1) {
c01014fe:	83 7d f4 1f          	cmpl   $0x1f,-0xc(%ebp)
c0101502:	7e 26                	jle    c010152a <readline+0x6a>
c0101504:	81 7d f0 fe 03 00 00 	cmpl   $0x3fe,-0x10(%ebp)
c010150b:	7f 1d                	jg     c010152a <readline+0x6a>
            cputchar(c);
c010150d:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0101510:	89 04 24             	mov    %eax,(%esp)
c0101513:	e8 da 00 00 00       	call   c01015f2 <cputchar>
            buf[i ++] = c;
c0101518:	8b 45 f0             	mov    -0x10(%ebp),%eax
c010151b:	8b 55 f4             	mov    -0xc(%ebp),%edx
c010151e:	88 90 a0 7a 12 c0    	mov    %dl,-0x3fed8560(%eax)
c0101524:	83 45 f0 01          	addl   $0x1,-0x10(%ebp)
    while (1) {
        c = getchar();
        if (c < 0) {
            return NULL;
        }
        else if (c >= ' ' && i < BUFSIZE - 1) {
c0101528:	eb 45                	jmp    c010156f <readline+0xaf>
            cputchar(c);
            buf[i ++] = c;
        }
        else if (c == '\b' && i > 0) {
c010152a:	83 7d f4 08          	cmpl   $0x8,-0xc(%ebp)
c010152e:	75 17                	jne    c0101547 <readline+0x87>
c0101530:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
c0101534:	7e 11                	jle    c0101547 <readline+0x87>
            cputchar(c);
c0101536:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0101539:	89 04 24             	mov    %eax,(%esp)
c010153c:	e8 b1 00 00 00       	call   c01015f2 <cputchar>
            i --;
c0101541:	83 6d f0 01          	subl   $0x1,-0x10(%ebp)
        }
        else if (c >= ' ' && i < BUFSIZE - 1) {
            cputchar(c);
            buf[i ++] = c;
        }
        else if (c == '\b' && i > 0) {
c0101545:	eb 28                	jmp    c010156f <readline+0xaf>
            cputchar(c);
            i --;
        }
        else if (c == '\n' || c == '\r') {
c0101547:	83 7d f4 0a          	cmpl   $0xa,-0xc(%ebp)
c010154b:	74 06                	je     c0101553 <readline+0x93>
c010154d:	83 7d f4 0d          	cmpl   $0xd,-0xc(%ebp)
c0101551:	75 95                	jne    c01014e8 <readline+0x28>
            cputchar(c);
c0101553:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0101556:	89 04 24             	mov    %eax,(%esp)
c0101559:	e8 94 00 00 00       	call   c01015f2 <cputchar>
            buf[i] = '\0';
c010155e:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0101561:	c6 80 a0 7a 12 c0 00 	movb   $0x0,-0x3fed8560(%eax)
            return buf;
c0101568:	b8 a0 7a 12 c0       	mov    $0xc0127aa0,%eax
c010156d:	eb 05                	jmp    c0101574 <readline+0xb4>
        }
    }
c010156f:	e9 75 ff ff ff       	jmp    c01014e9 <readline+0x29>
}
c0101574:	c9                   	leave  
c0101575:	c3                   	ret    
	...

c0101578 <cputch>:
/* *
 * cputch - writes a single character @c to stdout, and it will
 * increace the value of counter pointed by @cnt.
 * */
static void
cputch(int c, int *cnt) {
c0101578:	55                   	push   %ebp
c0101579:	89 e5                	mov    %esp,%ebp
c010157b:	83 ec 18             	sub    $0x18,%esp
    cons_putc(c);
c010157e:	8b 45 08             	mov    0x8(%ebp),%eax
c0101581:	89 04 24             	mov    %eax,(%esp)
c0101584:	e8 66 1e 00 00       	call   c01033ef <cons_putc>
    (*cnt) ++;
c0101589:	8b 45 0c             	mov    0xc(%ebp),%eax
c010158c:	8b 00                	mov    (%eax),%eax
c010158e:	8d 50 01             	lea    0x1(%eax),%edx
c0101591:	8b 45 0c             	mov    0xc(%ebp),%eax
c0101594:	89 10                	mov    %edx,(%eax)
}
c0101596:	c9                   	leave  
c0101597:	c3                   	ret    

c0101598 <vcprintf>:
 *
 * Call this function if you are already dealing with a va_list.
 * Or you probably want cprintf() instead.
 * */
int
vcprintf(const char *fmt, va_list ap) {
c0101598:	55                   	push   %ebp
c0101599:	89 e5                	mov    %esp,%ebp
c010159b:	83 ec 28             	sub    $0x28,%esp
    int cnt = 0;
c010159e:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
    vprintfmt((void*)cputch, &cnt, fmt, ap);
c01015a5:	b8 78 15 10 c0       	mov    $0xc0101578,%eax
c01015aa:	8b 55 0c             	mov    0xc(%ebp),%edx
c01015ad:	89 54 24 0c          	mov    %edx,0xc(%esp)
c01015b1:	8b 55 08             	mov    0x8(%ebp),%edx
c01015b4:	89 54 24 08          	mov    %edx,0x8(%esp)
c01015b8:	8d 55 f4             	lea    -0xc(%ebp),%edx
c01015bb:	89 54 24 04          	mov    %edx,0x4(%esp)
c01015bf:	89 04 24             	mov    %eax,(%esp)
c01015c2:	e8 a5 8d 00 00       	call   c010a36c <vprintfmt>
    return cnt;
c01015c7:	8b 45 f4             	mov    -0xc(%ebp),%eax
}
c01015ca:	c9                   	leave  
c01015cb:	c3                   	ret    

c01015cc <cprintf>:
 *
 * The return value is the number of characters which would be
 * written to stdout.
 * */
int
cprintf(const char *fmt, ...) {
c01015cc:	55                   	push   %ebp
c01015cd:	89 e5                	mov    %esp,%ebp
c01015cf:	83 ec 28             	sub    $0x28,%esp
    va_list ap;
    int cnt;
    va_start(ap, fmt);
c01015d2:	8d 45 0c             	lea    0xc(%ebp),%eax
c01015d5:	89 45 f0             	mov    %eax,-0x10(%ebp)
    cnt = vcprintf(fmt, ap);
c01015d8:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01015db:	89 44 24 04          	mov    %eax,0x4(%esp)
c01015df:	8b 45 08             	mov    0x8(%ebp),%eax
c01015e2:	89 04 24             	mov    %eax,(%esp)
c01015e5:	e8 ae ff ff ff       	call   c0101598 <vcprintf>
c01015ea:	89 45 f4             	mov    %eax,-0xc(%ebp)
    va_end(ap);
    return cnt;
c01015ed:	8b 45 f4             	mov    -0xc(%ebp),%eax
}
c01015f0:	c9                   	leave  
c01015f1:	c3                   	ret    

c01015f2 <cputchar>:

/* cputchar - writes a single character to stdout */
void
cputchar(int c) {
c01015f2:	55                   	push   %ebp
c01015f3:	89 e5                	mov    %esp,%ebp
c01015f5:	83 ec 18             	sub    $0x18,%esp
    cons_putc(c);
c01015f8:	8b 45 08             	mov    0x8(%ebp),%eax
c01015fb:	89 04 24             	mov    %eax,(%esp)
c01015fe:	e8 ec 1d 00 00       	call   c01033ef <cons_putc>
}
c0101603:	c9                   	leave  
c0101604:	c3                   	ret    

c0101605 <cputs>:
/* *
 * cputs- writes the string pointed by @str to stdout and
 * appends a newline character.
 * */
int
cputs(const char *str) {
c0101605:	55                   	push   %ebp
c0101606:	89 e5                	mov    %esp,%ebp
c0101608:	83 ec 28             	sub    $0x28,%esp
    int cnt = 0;
c010160b:	c7 45 f0 00 00 00 00 	movl   $0x0,-0x10(%ebp)
    char c;
    while ((c = *str ++) != '\0') {
c0101612:	eb 13                	jmp    c0101627 <cputs+0x22>
        cputch(c, &cnt);
c0101614:	0f be 45 f7          	movsbl -0x9(%ebp),%eax
c0101618:	8d 55 f0             	lea    -0x10(%ebp),%edx
c010161b:	89 54 24 04          	mov    %edx,0x4(%esp)
c010161f:	89 04 24             	mov    %eax,(%esp)
c0101622:	e8 51 ff ff ff       	call   c0101578 <cputch>
 * */
int
cputs(const char *str) {
    int cnt = 0;
    char c;
    while ((c = *str ++) != '\0') {
c0101627:	8b 45 08             	mov    0x8(%ebp),%eax
c010162a:	0f b6 00             	movzbl (%eax),%eax
c010162d:	88 45 f7             	mov    %al,-0x9(%ebp)
c0101630:	80 7d f7 00          	cmpb   $0x0,-0x9(%ebp)
c0101634:	0f 95 c0             	setne  %al
c0101637:	83 45 08 01          	addl   $0x1,0x8(%ebp)
c010163b:	84 c0                	test   %al,%al
c010163d:	75 d5                	jne    c0101614 <cputs+0xf>
        cputch(c, &cnt);
    }
    cputch('\n', &cnt);
c010163f:	8d 45 f0             	lea    -0x10(%ebp),%eax
c0101642:	89 44 24 04          	mov    %eax,0x4(%esp)
c0101646:	c7 04 24 0a 00 00 00 	movl   $0xa,(%esp)
c010164d:	e8 26 ff ff ff       	call   c0101578 <cputch>
    return cnt;
c0101652:	8b 45 f0             	mov    -0x10(%ebp),%eax
}
c0101655:	c9                   	leave  
c0101656:	c3                   	ret    

c0101657 <getchar>:

/* getchar - reads a single non-zero character from stdin */
int
getchar(void) {
c0101657:	55                   	push   %ebp
c0101658:	89 e5                	mov    %esp,%ebp
c010165a:	83 ec 18             	sub    $0x18,%esp
    int c;
    while ((c = cons_getc()) == 0)
c010165d:	e8 c9 1d 00 00       	call   c010342b <cons_getc>
c0101662:	89 45 f4             	mov    %eax,-0xc(%ebp)
c0101665:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c0101669:	74 f2                	je     c010165d <getchar+0x6>
        /* do nothing */;
    return c;
c010166b:	8b 45 f4             	mov    -0xc(%ebp),%eax
}
c010166e:	c9                   	leave  
c010166f:	c3                   	ret    

c0101670 <__intr_save>:
#include <x86.h>
#include <intr.h>
#include <mmu.h>

static inline bool
__intr_save(void) {
c0101670:	55                   	push   %ebp
c0101671:	89 e5                	mov    %esp,%ebp
c0101673:	83 ec 18             	sub    $0x18,%esp
}

static inline uint32_t
read_eflags(void) {
    uint32_t eflags;
    asm volatile ("pushfl; popl %0" : "=r" (eflags));
c0101676:	9c                   	pushf  
c0101677:	58                   	pop    %eax
c0101678:	89 45 f4             	mov    %eax,-0xc(%ebp)
    return eflags;
c010167b:	8b 45 f4             	mov    -0xc(%ebp),%eax
    if (read_eflags() & FL_IF) {
c010167e:	25 00 02 00 00       	and    $0x200,%eax
c0101683:	85 c0                	test   %eax,%eax
c0101685:	74 0c                	je     c0101693 <__intr_save+0x23>
        intr_disable();
c0101687:	e8 16 1e 00 00       	call   c01034a2 <intr_disable>
        return 1;
c010168c:	b8 01 00 00 00       	mov    $0x1,%eax
c0101691:	eb 05                	jmp    c0101698 <__intr_save+0x28>
    }
    return 0;
c0101693:	b8 00 00 00 00       	mov    $0x0,%eax
}
c0101698:	c9                   	leave  
c0101699:	c3                   	ret    

c010169a <__intr_restore>:

static inline void
__intr_restore(bool flag) {
c010169a:	55                   	push   %ebp
c010169b:	89 e5                	mov    %esp,%ebp
c010169d:	83 ec 08             	sub    $0x8,%esp
    if (flag) {
c01016a0:	83 7d 08 00          	cmpl   $0x0,0x8(%ebp)
c01016a4:	74 05                	je     c01016ab <__intr_restore+0x11>
        intr_enable();
c01016a6:	e8 f1 1d 00 00       	call   c010349c <intr_enable>
    }
}
c01016ab:	c9                   	leave  
c01016ac:	c3                   	ret    

c01016ad <stab_binsearch>:
 *      stab_binsearch(stabs, &left, &right, N_SO, 0xf0100184);
 * will exit setting left = 118, right = 554.
 * */
static void
stab_binsearch(const struct stab *stabs, int *region_left, int *region_right,
           int type, uintptr_t addr) {
c01016ad:	55                   	push   %ebp
c01016ae:	89 e5                	mov    %esp,%ebp
c01016b0:	83 ec 20             	sub    $0x20,%esp
    int l = *region_left, r = *region_right, any_matches = 0;
c01016b3:	8b 45 0c             	mov    0xc(%ebp),%eax
c01016b6:	8b 00                	mov    (%eax),%eax
c01016b8:	89 45 ec             	mov    %eax,-0x14(%ebp)
c01016bb:	8b 45 10             	mov    0x10(%ebp),%eax
c01016be:	8b 00                	mov    (%eax),%eax
c01016c0:	89 45 f0             	mov    %eax,-0x10(%ebp)
c01016c3:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)

    while (l <= r) {
c01016ca:	e9 c8 00 00 00       	jmp    c0101797 <stab_binsearch+0xea>
        int true_m = (l + r) / 2, m = true_m;
c01016cf:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01016d2:	8b 55 ec             	mov    -0x14(%ebp),%edx
c01016d5:	8d 04 02             	lea    (%edx,%eax,1),%eax
c01016d8:	89 c2                	mov    %eax,%edx
c01016da:	c1 ea 1f             	shr    $0x1f,%edx
c01016dd:	8d 04 02             	lea    (%edx,%eax,1),%eax
c01016e0:	d1 f8                	sar    %eax
c01016e2:	89 45 f8             	mov    %eax,-0x8(%ebp)
c01016e5:	8b 45 f8             	mov    -0x8(%ebp),%eax
c01016e8:	89 45 fc             	mov    %eax,-0x4(%ebp)

        // search for earliest stab with right type
        while (m >= l && stabs[m].n_type != type) {
c01016eb:	eb 04                	jmp    c01016f1 <stab_binsearch+0x44>
            m --;
c01016ed:	83 6d fc 01          	subl   $0x1,-0x4(%ebp)

    while (l <= r) {
        int true_m = (l + r) / 2, m = true_m;

        // search for earliest stab with right type
        while (m >= l && stabs[m].n_type != type) {
c01016f1:	8b 45 fc             	mov    -0x4(%ebp),%eax
c01016f4:	3b 45 ec             	cmp    -0x14(%ebp),%eax
c01016f7:	7c 1b                	jl     c0101714 <stab_binsearch+0x67>
c01016f9:	8b 55 fc             	mov    -0x4(%ebp),%edx
c01016fc:	89 d0                	mov    %edx,%eax
c01016fe:	01 c0                	add    %eax,%eax
c0101700:	01 d0                	add    %edx,%eax
c0101702:	c1 e0 02             	shl    $0x2,%eax
c0101705:	03 45 08             	add    0x8(%ebp),%eax
c0101708:	0f b6 40 04          	movzbl 0x4(%eax),%eax
c010170c:	0f b6 c0             	movzbl %al,%eax
c010170f:	3b 45 14             	cmp    0x14(%ebp),%eax
c0101712:	75 d9                	jne    c01016ed <stab_binsearch+0x40>
            m --;
        }
        if (m < l) {    // no match in [l, m]
c0101714:	8b 45 fc             	mov    -0x4(%ebp),%eax
c0101717:	3b 45 ec             	cmp    -0x14(%ebp),%eax
c010171a:	7d 0b                	jge    c0101727 <stab_binsearch+0x7a>
            l = true_m + 1;
c010171c:	8b 45 f8             	mov    -0x8(%ebp),%eax
c010171f:	83 c0 01             	add    $0x1,%eax
c0101722:	89 45 ec             	mov    %eax,-0x14(%ebp)
            continue;
c0101725:	eb 70                	jmp    c0101797 <stab_binsearch+0xea>
        }

        // actual binary search
        any_matches = 1;
c0101727:	c7 45 f4 01 00 00 00 	movl   $0x1,-0xc(%ebp)
        if (stabs[m].n_value < addr) {
c010172e:	8b 55 fc             	mov    -0x4(%ebp),%edx
c0101731:	89 d0                	mov    %edx,%eax
c0101733:	01 c0                	add    %eax,%eax
c0101735:	01 d0                	add    %edx,%eax
c0101737:	c1 e0 02             	shl    $0x2,%eax
c010173a:	03 45 08             	add    0x8(%ebp),%eax
c010173d:	8b 40 08             	mov    0x8(%eax),%eax
c0101740:	3b 45 18             	cmp    0x18(%ebp),%eax
c0101743:	73 13                	jae    c0101758 <stab_binsearch+0xab>
            *region_left = m;
c0101745:	8b 45 0c             	mov    0xc(%ebp),%eax
c0101748:	8b 55 fc             	mov    -0x4(%ebp),%edx
c010174b:	89 10                	mov    %edx,(%eax)
            l = true_m + 1;
c010174d:	8b 45 f8             	mov    -0x8(%ebp),%eax
c0101750:	83 c0 01             	add    $0x1,%eax
c0101753:	89 45 ec             	mov    %eax,-0x14(%ebp)
c0101756:	eb 3f                	jmp    c0101797 <stab_binsearch+0xea>
        } else if (stabs[m].n_value > addr) {
c0101758:	8b 55 fc             	mov    -0x4(%ebp),%edx
c010175b:	89 d0                	mov    %edx,%eax
c010175d:	01 c0                	add    %eax,%eax
c010175f:	01 d0                	add    %edx,%eax
c0101761:	c1 e0 02             	shl    $0x2,%eax
c0101764:	03 45 08             	add    0x8(%ebp),%eax
c0101767:	8b 40 08             	mov    0x8(%eax),%eax
c010176a:	3b 45 18             	cmp    0x18(%ebp),%eax
c010176d:	76 16                	jbe    c0101785 <stab_binsearch+0xd8>
            *region_right = m - 1;
c010176f:	8b 45 fc             	mov    -0x4(%ebp),%eax
c0101772:	8d 50 ff             	lea    -0x1(%eax),%edx
c0101775:	8b 45 10             	mov    0x10(%ebp),%eax
c0101778:	89 10                	mov    %edx,(%eax)
            r = m - 1;
c010177a:	8b 45 fc             	mov    -0x4(%ebp),%eax
c010177d:	83 e8 01             	sub    $0x1,%eax
c0101780:	89 45 f0             	mov    %eax,-0x10(%ebp)
c0101783:	eb 12                	jmp    c0101797 <stab_binsearch+0xea>
        } else {
            // exact match for 'addr', but continue loop to find
            // *region_right
            *region_left = m;
c0101785:	8b 45 0c             	mov    0xc(%ebp),%eax
c0101788:	8b 55 fc             	mov    -0x4(%ebp),%edx
c010178b:	89 10                	mov    %edx,(%eax)
            l = m;
c010178d:	8b 45 fc             	mov    -0x4(%ebp),%eax
c0101790:	89 45 ec             	mov    %eax,-0x14(%ebp)
            addr ++;
c0101793:	83 45 18 01          	addl   $0x1,0x18(%ebp)
static void
stab_binsearch(const struct stab *stabs, int *region_left, int *region_right,
           int type, uintptr_t addr) {
    int l = *region_left, r = *region_right, any_matches = 0;

    while (l <= r) {
c0101797:	8b 45 ec             	mov    -0x14(%ebp),%eax
c010179a:	3b 45 f0             	cmp    -0x10(%ebp),%eax
c010179d:	0f 8e 2c ff ff ff    	jle    c01016cf <stab_binsearch+0x22>
            l = m;
            addr ++;
        }
    }

    if (!any_matches) {
c01017a3:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c01017a7:	75 0f                	jne    c01017b8 <stab_binsearch+0x10b>
        *region_right = *region_left - 1;
c01017a9:	8b 45 0c             	mov    0xc(%ebp),%eax
c01017ac:	8b 00                	mov    (%eax),%eax
c01017ae:	8d 50 ff             	lea    -0x1(%eax),%edx
c01017b1:	8b 45 10             	mov    0x10(%ebp),%eax
c01017b4:	89 10                	mov    %edx,(%eax)
c01017b6:	eb 3b                	jmp    c01017f3 <stab_binsearch+0x146>
    }
    else {
        // find rightmost region containing 'addr'
        l = *region_right;
c01017b8:	8b 45 10             	mov    0x10(%ebp),%eax
c01017bb:	8b 00                	mov    (%eax),%eax
c01017bd:	89 45 ec             	mov    %eax,-0x14(%ebp)
        for (; l > *region_left && stabs[l].n_type != type; l --)
c01017c0:	eb 04                	jmp    c01017c6 <stab_binsearch+0x119>
c01017c2:	83 6d ec 01          	subl   $0x1,-0x14(%ebp)
c01017c6:	8b 45 0c             	mov    0xc(%ebp),%eax
c01017c9:	8b 00                	mov    (%eax),%eax
c01017cb:	3b 45 ec             	cmp    -0x14(%ebp),%eax
c01017ce:	7d 1b                	jge    c01017eb <stab_binsearch+0x13e>
c01017d0:	8b 55 ec             	mov    -0x14(%ebp),%edx
c01017d3:	89 d0                	mov    %edx,%eax
c01017d5:	01 c0                	add    %eax,%eax
c01017d7:	01 d0                	add    %edx,%eax
c01017d9:	c1 e0 02             	shl    $0x2,%eax
c01017dc:	03 45 08             	add    0x8(%ebp),%eax
c01017df:	0f b6 40 04          	movzbl 0x4(%eax),%eax
c01017e3:	0f b6 c0             	movzbl %al,%eax
c01017e6:	3b 45 14             	cmp    0x14(%ebp),%eax
c01017e9:	75 d7                	jne    c01017c2 <stab_binsearch+0x115>
            /* do nothing */;
        *region_left = l;
c01017eb:	8b 45 0c             	mov    0xc(%ebp),%eax
c01017ee:	8b 55 ec             	mov    -0x14(%ebp),%edx
c01017f1:	89 10                	mov    %edx,(%eax)
    }
}
c01017f3:	c9                   	leave  
c01017f4:	c3                   	ret    

c01017f5 <debuginfo_eip>:
 * the specified instruction address, @addr.  Returns 0 if information
 * was found, and negative if not.  But even if it returns negative it
 * has stored some information into '*info'.
 * */
int
debuginfo_eip(uintptr_t addr, struct eipdebuginfo *info) {
c01017f5:	55                   	push   %ebp
c01017f6:	89 e5                	mov    %esp,%ebp
c01017f8:	53                   	push   %ebx
c01017f9:	83 ec 54             	sub    $0x54,%esp
    const struct stab *stabs, *stab_end;
    const char *stabstr, *stabstr_end;

    info->eip_file = "<unknown>";
c01017fc:	8b 45 0c             	mov    0xc(%ebp),%eax
c01017ff:	c7 00 60 b0 10 c0    	movl   $0xc010b060,(%eax)
    info->eip_line = 0;
c0101805:	8b 45 0c             	mov    0xc(%ebp),%eax
c0101808:	c7 40 04 00 00 00 00 	movl   $0x0,0x4(%eax)
    info->eip_fn_name = "<unknown>";
c010180f:	8b 45 0c             	mov    0xc(%ebp),%eax
c0101812:	c7 40 08 60 b0 10 c0 	movl   $0xc010b060,0x8(%eax)
    info->eip_fn_namelen = 9;
c0101819:	8b 45 0c             	mov    0xc(%ebp),%eax
c010181c:	c7 40 0c 09 00 00 00 	movl   $0x9,0xc(%eax)
    info->eip_fn_addr = addr;
c0101823:	8b 45 0c             	mov    0xc(%ebp),%eax
c0101826:	8b 55 08             	mov    0x8(%ebp),%edx
c0101829:	89 50 10             	mov    %edx,0x10(%eax)
    info->eip_fn_narg = 0;
c010182c:	8b 45 0c             	mov    0xc(%ebp),%eax
c010182f:	c7 40 14 00 00 00 00 	movl   $0x0,0x14(%eax)

    stabs = __STAB_BEGIN__;
c0101836:	c7 45 e8 44 d2 10 c0 	movl   $0xc010d244,-0x18(%ebp)
    stab_end = __STAB_END__;
c010183d:	c7 45 ec 3c 06 12 c0 	movl   $0xc012063c,-0x14(%ebp)
    stabstr = __STABSTR_BEGIN__;
c0101844:	c7 45 f0 3d 06 12 c0 	movl   $0xc012063d,-0x10(%ebp)
    stabstr_end = __STABSTR_END__;
c010184b:	c7 45 f4 3d 46 12 c0 	movl   $0xc012463d,-0xc(%ebp)

    // String table validity checks
    if (stabstr_end <= stabstr || stabstr_end[-1] != 0) {
c0101852:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0101855:	3b 45 f0             	cmp    -0x10(%ebp),%eax
c0101858:	76 0d                	jbe    c0101867 <debuginfo_eip+0x72>
c010185a:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010185d:	83 e8 01             	sub    $0x1,%eax
c0101860:	0f b6 00             	movzbl (%eax),%eax
c0101863:	84 c0                	test   %al,%al
c0101865:	74 0a                	je     c0101871 <debuginfo_eip+0x7c>
        return -1;
c0101867:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
c010186c:	e9 9e 02 00 00       	jmp    c0101b0f <debuginfo_eip+0x31a>
    // 'eip'.  First, we find the basic source file containing 'eip'.
    // Then, we look in that source file for the function.  Then we look
    // for the line number.

    // Search the entire set of stabs for the source file (type N_SO).
    int lfile = 0, rfile = (stab_end - stabs) - 1;
c0101871:	c7 45 e4 00 00 00 00 	movl   $0x0,-0x1c(%ebp)
c0101878:	8b 55 ec             	mov    -0x14(%ebp),%edx
c010187b:	8b 45 e8             	mov    -0x18(%ebp),%eax
c010187e:	89 d1                	mov    %edx,%ecx
c0101880:	29 c1                	sub    %eax,%ecx
c0101882:	89 c8                	mov    %ecx,%eax
c0101884:	c1 f8 02             	sar    $0x2,%eax
c0101887:	69 c0 ab aa aa aa    	imul   $0xaaaaaaab,%eax,%eax
c010188d:	83 e8 01             	sub    $0x1,%eax
c0101890:	89 45 e0             	mov    %eax,-0x20(%ebp)
    stab_binsearch(stabs, &lfile, &rfile, N_SO, addr);
c0101893:	8b 45 08             	mov    0x8(%ebp),%eax
c0101896:	89 44 24 10          	mov    %eax,0x10(%esp)
c010189a:	c7 44 24 0c 64 00 00 	movl   $0x64,0xc(%esp)
c01018a1:	00 
c01018a2:	8d 45 e0             	lea    -0x20(%ebp),%eax
c01018a5:	89 44 24 08          	mov    %eax,0x8(%esp)
c01018a9:	8d 45 e4             	lea    -0x1c(%ebp),%eax
c01018ac:	89 44 24 04          	mov    %eax,0x4(%esp)
c01018b0:	8b 45 e8             	mov    -0x18(%ebp),%eax
c01018b3:	89 04 24             	mov    %eax,(%esp)
c01018b6:	e8 f2 fd ff ff       	call   c01016ad <stab_binsearch>
    if (lfile == 0)
c01018bb:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c01018be:	85 c0                	test   %eax,%eax
c01018c0:	75 0a                	jne    c01018cc <debuginfo_eip+0xd7>
        return -1;
c01018c2:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
c01018c7:	e9 43 02 00 00       	jmp    c0101b0f <debuginfo_eip+0x31a>

    // Search within that file's stabs for the function definition
    // (N_FUN).
    int lfun = lfile, rfun = rfile;
c01018cc:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c01018cf:	89 45 dc             	mov    %eax,-0x24(%ebp)
c01018d2:	8b 45 e0             	mov    -0x20(%ebp),%eax
c01018d5:	89 45 d8             	mov    %eax,-0x28(%ebp)
    int lline, rline;
    stab_binsearch(stabs, &lfun, &rfun, N_FUN, addr);
c01018d8:	8b 45 08             	mov    0x8(%ebp),%eax
c01018db:	89 44 24 10          	mov    %eax,0x10(%esp)
c01018df:	c7 44 24 0c 24 00 00 	movl   $0x24,0xc(%esp)
c01018e6:	00 
c01018e7:	8d 45 d8             	lea    -0x28(%ebp),%eax
c01018ea:	89 44 24 08          	mov    %eax,0x8(%esp)
c01018ee:	8d 45 dc             	lea    -0x24(%ebp),%eax
c01018f1:	89 44 24 04          	mov    %eax,0x4(%esp)
c01018f5:	8b 45 e8             	mov    -0x18(%ebp),%eax
c01018f8:	89 04 24             	mov    %eax,(%esp)
c01018fb:	e8 ad fd ff ff       	call   c01016ad <stab_binsearch>

    if (lfun <= rfun) {
c0101900:	8b 55 dc             	mov    -0x24(%ebp),%edx
c0101903:	8b 45 d8             	mov    -0x28(%ebp),%eax
c0101906:	39 c2                	cmp    %eax,%edx
c0101908:	7f 72                	jg     c010197c <debuginfo_eip+0x187>
        // stabs[lfun] points to the function name
        // in the string table, but check bounds just in case.
        if (stabs[lfun].n_strx < stabstr_end - stabstr) {
c010190a:	8b 45 dc             	mov    -0x24(%ebp),%eax
c010190d:	89 c2                	mov    %eax,%edx
c010190f:	89 d0                	mov    %edx,%eax
c0101911:	01 c0                	add    %eax,%eax
c0101913:	01 d0                	add    %edx,%eax
c0101915:	c1 e0 02             	shl    $0x2,%eax
c0101918:	03 45 e8             	add    -0x18(%ebp),%eax
c010191b:	8b 10                	mov    (%eax),%edx
c010191d:	8b 4d f4             	mov    -0xc(%ebp),%ecx
c0101920:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0101923:	89 cb                	mov    %ecx,%ebx
c0101925:	29 c3                	sub    %eax,%ebx
c0101927:	89 d8                	mov    %ebx,%eax
c0101929:	39 c2                	cmp    %eax,%edx
c010192b:	73 1e                	jae    c010194b <debuginfo_eip+0x156>
            info->eip_fn_name = stabstr + stabs[lfun].n_strx;
c010192d:	8b 45 dc             	mov    -0x24(%ebp),%eax
c0101930:	89 c2                	mov    %eax,%edx
c0101932:	89 d0                	mov    %edx,%eax
c0101934:	01 c0                	add    %eax,%eax
c0101936:	01 d0                	add    %edx,%eax
c0101938:	c1 e0 02             	shl    $0x2,%eax
c010193b:	03 45 e8             	add    -0x18(%ebp),%eax
c010193e:	8b 00                	mov    (%eax),%eax
c0101940:	89 c2                	mov    %eax,%edx
c0101942:	03 55 f0             	add    -0x10(%ebp),%edx
c0101945:	8b 45 0c             	mov    0xc(%ebp),%eax
c0101948:	89 50 08             	mov    %edx,0x8(%eax)
        }
        info->eip_fn_addr = stabs[lfun].n_value;
c010194b:	8b 45 dc             	mov    -0x24(%ebp),%eax
c010194e:	89 c2                	mov    %eax,%edx
c0101950:	89 d0                	mov    %edx,%eax
c0101952:	01 c0                	add    %eax,%eax
c0101954:	01 d0                	add    %edx,%eax
c0101956:	c1 e0 02             	shl    $0x2,%eax
c0101959:	03 45 e8             	add    -0x18(%ebp),%eax
c010195c:	8b 50 08             	mov    0x8(%eax),%edx
c010195f:	8b 45 0c             	mov    0xc(%ebp),%eax
c0101962:	89 50 10             	mov    %edx,0x10(%eax)
        addr -= info->eip_fn_addr;
c0101965:	8b 45 0c             	mov    0xc(%ebp),%eax
c0101968:	8b 40 10             	mov    0x10(%eax),%eax
c010196b:	29 45 08             	sub    %eax,0x8(%ebp)
        // Search within the function definition for the line number.
        lline = lfun;
c010196e:	8b 45 dc             	mov    -0x24(%ebp),%eax
c0101971:	89 45 d4             	mov    %eax,-0x2c(%ebp)
        rline = rfun;
c0101974:	8b 45 d8             	mov    -0x28(%ebp),%eax
c0101977:	89 45 d0             	mov    %eax,-0x30(%ebp)
c010197a:	eb 15                	jmp    c0101991 <debuginfo_eip+0x19c>
    } else {
        // Couldn't find function stab!  Maybe we're in an assembly
        // file.  Search the whole file for the line number.
        info->eip_fn_addr = addr;
c010197c:	8b 45 0c             	mov    0xc(%ebp),%eax
c010197f:	8b 55 08             	mov    0x8(%ebp),%edx
c0101982:	89 50 10             	mov    %edx,0x10(%eax)
        lline = lfile;
c0101985:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0101988:	89 45 d4             	mov    %eax,-0x2c(%ebp)
        rline = rfile;
c010198b:	8b 45 e0             	mov    -0x20(%ebp),%eax
c010198e:	89 45 d0             	mov    %eax,-0x30(%ebp)
    }
    info->eip_fn_namelen = strfind(info->eip_fn_name, ':') - info->eip_fn_name;
c0101991:	8b 45 0c             	mov    0xc(%ebp),%eax
c0101994:	8b 40 08             	mov    0x8(%eax),%eax
c0101997:	c7 44 24 04 3a 00 00 	movl   $0x3a,0x4(%esp)
c010199e:	00 
c010199f:	89 04 24             	mov    %eax,(%esp)
c01019a2:	e8 14 91 00 00       	call   c010aabb <strfind>
c01019a7:	89 c2                	mov    %eax,%edx
c01019a9:	8b 45 0c             	mov    0xc(%ebp),%eax
c01019ac:	8b 40 08             	mov    0x8(%eax),%eax
c01019af:	29 c2                	sub    %eax,%edx
c01019b1:	8b 45 0c             	mov    0xc(%ebp),%eax
c01019b4:	89 50 0c             	mov    %edx,0xc(%eax)

    // Search within [lline, rline] for the line number stab.
    // If found, set info->eip_line to the right line number.
    // If not found, return -1.
    stab_binsearch(stabs, &lline, &rline, N_SLINE, addr);
c01019b7:	8b 45 08             	mov    0x8(%ebp),%eax
c01019ba:	89 44 24 10          	mov    %eax,0x10(%esp)
c01019be:	c7 44 24 0c 44 00 00 	movl   $0x44,0xc(%esp)
c01019c5:	00 
c01019c6:	8d 45 d0             	lea    -0x30(%ebp),%eax
c01019c9:	89 44 24 08          	mov    %eax,0x8(%esp)
c01019cd:	8d 45 d4             	lea    -0x2c(%ebp),%eax
c01019d0:	89 44 24 04          	mov    %eax,0x4(%esp)
c01019d4:	8b 45 e8             	mov    -0x18(%ebp),%eax
c01019d7:	89 04 24             	mov    %eax,(%esp)
c01019da:	e8 ce fc ff ff       	call   c01016ad <stab_binsearch>
    if (lline <= rline) {
c01019df:	8b 55 d4             	mov    -0x2c(%ebp),%edx
c01019e2:	8b 45 d0             	mov    -0x30(%ebp),%eax
c01019e5:	39 c2                	cmp    %eax,%edx
c01019e7:	7f 20                	jg     c0101a09 <debuginfo_eip+0x214>
        info->eip_line = stabs[rline].n_desc;
c01019e9:	8b 45 d0             	mov    -0x30(%ebp),%eax
c01019ec:	89 c2                	mov    %eax,%edx
c01019ee:	89 d0                	mov    %edx,%eax
c01019f0:	01 c0                	add    %eax,%eax
c01019f2:	01 d0                	add    %edx,%eax
c01019f4:	c1 e0 02             	shl    $0x2,%eax
c01019f7:	03 45 e8             	add    -0x18(%ebp),%eax
c01019fa:	0f b7 40 06          	movzwl 0x6(%eax),%eax
c01019fe:	0f b7 d0             	movzwl %ax,%edx
c0101a01:	8b 45 0c             	mov    0xc(%ebp),%eax
c0101a04:	89 50 04             	mov    %edx,0x4(%eax)

    // Search backwards from the line number for the relevant filename stab.
    // We can't just use the "lfile" stab because inlined functions
    // can interpolate code from a different file!
    // Such included source files use the N_SOL stab type.
    while (lline >= lfile
c0101a07:	eb 13                	jmp    c0101a1c <debuginfo_eip+0x227>
    // If not found, return -1.
    stab_binsearch(stabs, &lline, &rline, N_SLINE, addr);
    if (lline <= rline) {
        info->eip_line = stabs[rline].n_desc;
    } else {
        return -1;
c0101a09:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
c0101a0e:	e9 fc 00 00 00       	jmp    c0101b0f <debuginfo_eip+0x31a>
    // can interpolate code from a different file!
    // Such included source files use the N_SOL stab type.
    while (lline >= lfile
           && stabs[lline].n_type != N_SOL
           && (stabs[lline].n_type != N_SO || !stabs[lline].n_value)) {
        lline --;
c0101a13:	8b 45 d4             	mov    -0x2c(%ebp),%eax
c0101a16:	83 e8 01             	sub    $0x1,%eax
c0101a19:	89 45 d4             	mov    %eax,-0x2c(%ebp)
    // Search backwards from the line number for the relevant filename stab.
    // We can't just use the "lfile" stab because inlined functions
    // can interpolate code from a different file!
    // Such included source files use the N_SOL stab type.
    while (lline >= lfile
           && stabs[lline].n_type != N_SOL
c0101a1c:	8b 55 d4             	mov    -0x2c(%ebp),%edx
c0101a1f:	8b 45 e4             	mov    -0x1c(%ebp),%eax

    // Search backwards from the line number for the relevant filename stab.
    // We can't just use the "lfile" stab because inlined functions
    // can interpolate code from a different file!
    // Such included source files use the N_SOL stab type.
    while (lline >= lfile
c0101a22:	39 c2                	cmp    %eax,%edx
c0101a24:	7c 4a                	jl     c0101a70 <debuginfo_eip+0x27b>
           && stabs[lline].n_type != N_SOL
c0101a26:	8b 45 d4             	mov    -0x2c(%ebp),%eax
c0101a29:	89 c2                	mov    %eax,%edx
c0101a2b:	89 d0                	mov    %edx,%eax
c0101a2d:	01 c0                	add    %eax,%eax
c0101a2f:	01 d0                	add    %edx,%eax
c0101a31:	c1 e0 02             	shl    $0x2,%eax
c0101a34:	03 45 e8             	add    -0x18(%ebp),%eax
           && (stabs[lline].n_type != N_SO || !stabs[lline].n_value)) {
c0101a37:	0f b6 40 04          	movzbl 0x4(%eax),%eax

    // Search backwards from the line number for the relevant filename stab.
    // We can't just use the "lfile" stab because inlined functions
    // can interpolate code from a different file!
    // Such included source files use the N_SOL stab type.
    while (lline >= lfile
c0101a3b:	3c 84                	cmp    $0x84,%al
c0101a3d:	74 31                	je     c0101a70 <debuginfo_eip+0x27b>
           && stabs[lline].n_type != N_SOL
           && (stabs[lline].n_type != N_SO || !stabs[lline].n_value)) {
c0101a3f:	8b 45 d4             	mov    -0x2c(%ebp),%eax
c0101a42:	89 c2                	mov    %eax,%edx
c0101a44:	89 d0                	mov    %edx,%eax
c0101a46:	01 c0                	add    %eax,%eax
c0101a48:	01 d0                	add    %edx,%eax
c0101a4a:	c1 e0 02             	shl    $0x2,%eax
c0101a4d:	03 45 e8             	add    -0x18(%ebp),%eax
c0101a50:	0f b6 40 04          	movzbl 0x4(%eax),%eax

    // Search backwards from the line number for the relevant filename stab.
    // We can't just use the "lfile" stab because inlined functions
    // can interpolate code from a different file!
    // Such included source files use the N_SOL stab type.
    while (lline >= lfile
c0101a54:	3c 64                	cmp    $0x64,%al
c0101a56:	75 bb                	jne    c0101a13 <debuginfo_eip+0x21e>
           && stabs[lline].n_type != N_SOL
           && (stabs[lline].n_type != N_SO || !stabs[lline].n_value)) {
c0101a58:	8b 45 d4             	mov    -0x2c(%ebp),%eax
c0101a5b:	89 c2                	mov    %eax,%edx
c0101a5d:	89 d0                	mov    %edx,%eax
c0101a5f:	01 c0                	add    %eax,%eax
c0101a61:	01 d0                	add    %edx,%eax
c0101a63:	c1 e0 02             	shl    $0x2,%eax
c0101a66:	03 45 e8             	add    -0x18(%ebp),%eax
c0101a69:	8b 40 08             	mov    0x8(%eax),%eax

    // Search backwards from the line number for the relevant filename stab.
    // We can't just use the "lfile" stab because inlined functions
    // can interpolate code from a different file!
    // Such included source files use the N_SOL stab type.
    while (lline >= lfile
c0101a6c:	85 c0                	test   %eax,%eax
c0101a6e:	74 a3                	je     c0101a13 <debuginfo_eip+0x21e>
           && stabs[lline].n_type != N_SOL
           && (stabs[lline].n_type != N_SO || !stabs[lline].n_value)) {
        lline --;
    }
    if (lline >= lfile && stabs[lline].n_strx < stabstr_end - stabstr) {
c0101a70:	8b 55 d4             	mov    -0x2c(%ebp),%edx
c0101a73:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0101a76:	39 c2                	cmp    %eax,%edx
c0101a78:	7c 40                	jl     c0101aba <debuginfo_eip+0x2c5>
c0101a7a:	8b 45 d4             	mov    -0x2c(%ebp),%eax
c0101a7d:	89 c2                	mov    %eax,%edx
c0101a7f:	89 d0                	mov    %edx,%eax
c0101a81:	01 c0                	add    %eax,%eax
c0101a83:	01 d0                	add    %edx,%eax
c0101a85:	c1 e0 02             	shl    $0x2,%eax
c0101a88:	03 45 e8             	add    -0x18(%ebp),%eax
c0101a8b:	8b 10                	mov    (%eax),%edx
c0101a8d:	8b 4d f4             	mov    -0xc(%ebp),%ecx
c0101a90:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0101a93:	89 cb                	mov    %ecx,%ebx
c0101a95:	29 c3                	sub    %eax,%ebx
c0101a97:	89 d8                	mov    %ebx,%eax
c0101a99:	39 c2                	cmp    %eax,%edx
c0101a9b:	73 1d                	jae    c0101aba <debuginfo_eip+0x2c5>
        info->eip_file = stabstr + stabs[lline].n_strx;
c0101a9d:	8b 45 d4             	mov    -0x2c(%ebp),%eax
c0101aa0:	89 c2                	mov    %eax,%edx
c0101aa2:	89 d0                	mov    %edx,%eax
c0101aa4:	01 c0                	add    %eax,%eax
c0101aa6:	01 d0                	add    %edx,%eax
c0101aa8:	c1 e0 02             	shl    $0x2,%eax
c0101aab:	03 45 e8             	add    -0x18(%ebp),%eax
c0101aae:	8b 00                	mov    (%eax),%eax
c0101ab0:	89 c2                	mov    %eax,%edx
c0101ab2:	03 55 f0             	add    -0x10(%ebp),%edx
c0101ab5:	8b 45 0c             	mov    0xc(%ebp),%eax
c0101ab8:	89 10                	mov    %edx,(%eax)
    }

    // Set eip_fn_narg to the number of arguments taken by the function,
    // or 0 if there was no containing function.
    if (lfun < rfun) {
c0101aba:	8b 55 dc             	mov    -0x24(%ebp),%edx
c0101abd:	8b 45 d8             	mov    -0x28(%ebp),%eax
c0101ac0:	39 c2                	cmp    %eax,%edx
c0101ac2:	7d 46                	jge    c0101b0a <debuginfo_eip+0x315>
        for (lline = lfun + 1;
c0101ac4:	8b 45 dc             	mov    -0x24(%ebp),%eax
c0101ac7:	83 c0 01             	add    $0x1,%eax
c0101aca:	89 45 d4             	mov    %eax,-0x2c(%ebp)
c0101acd:	eb 18                	jmp    c0101ae7 <debuginfo_eip+0x2f2>
             lline < rfun && stabs[lline].n_type == N_PSYM;
             lline ++) {
            info->eip_fn_narg ++;
c0101acf:	8b 45 0c             	mov    0xc(%ebp),%eax
c0101ad2:	8b 40 14             	mov    0x14(%eax),%eax
c0101ad5:	8d 50 01             	lea    0x1(%eax),%edx
c0101ad8:	8b 45 0c             	mov    0xc(%ebp),%eax
c0101adb:	89 50 14             	mov    %edx,0x14(%eax)
    // Set eip_fn_narg to the number of arguments taken by the function,
    // or 0 if there was no containing function.
    if (lfun < rfun) {
        for (lline = lfun + 1;
             lline < rfun && stabs[lline].n_type == N_PSYM;
             lline ++) {
c0101ade:	8b 45 d4             	mov    -0x2c(%ebp),%eax
c0101ae1:	83 c0 01             	add    $0x1,%eax
c0101ae4:	89 45 d4             	mov    %eax,-0x2c(%ebp)

    // Set eip_fn_narg to the number of arguments taken by the function,
    // or 0 if there was no containing function.
    if (lfun < rfun) {
        for (lline = lfun + 1;
             lline < rfun && stabs[lline].n_type == N_PSYM;
c0101ae7:	8b 55 d4             	mov    -0x2c(%ebp),%edx
c0101aea:	8b 45 d8             	mov    -0x28(%ebp),%eax
    }

    // Set eip_fn_narg to the number of arguments taken by the function,
    // or 0 if there was no containing function.
    if (lfun < rfun) {
        for (lline = lfun + 1;
c0101aed:	39 c2                	cmp    %eax,%edx
c0101aef:	7d 19                	jge    c0101b0a <debuginfo_eip+0x315>
             lline < rfun && stabs[lline].n_type == N_PSYM;
c0101af1:	8b 45 d4             	mov    -0x2c(%ebp),%eax
c0101af4:	89 c2                	mov    %eax,%edx
c0101af6:	89 d0                	mov    %edx,%eax
c0101af8:	01 c0                	add    %eax,%eax
c0101afa:	01 d0                	add    %edx,%eax
c0101afc:	c1 e0 02             	shl    $0x2,%eax
c0101aff:	03 45 e8             	add    -0x18(%ebp),%eax
c0101b02:	0f b6 40 04          	movzbl 0x4(%eax),%eax
    }

    // Set eip_fn_narg to the number of arguments taken by the function,
    // or 0 if there was no containing function.
    if (lfun < rfun) {
        for (lline = lfun + 1;
c0101b06:	3c a0                	cmp    $0xa0,%al
c0101b08:	74 c5                	je     c0101acf <debuginfo_eip+0x2da>
             lline < rfun && stabs[lline].n_type == N_PSYM;
             lline ++) {
            info->eip_fn_narg ++;
        }
    }
    return 0;
c0101b0a:	b8 00 00 00 00       	mov    $0x0,%eax
}
c0101b0f:	83 c4 54             	add    $0x54,%esp
c0101b12:	5b                   	pop    %ebx
c0101b13:	5d                   	pop    %ebp
c0101b14:	c3                   	ret    

c0101b15 <print_kerninfo>:
 * print_kerninfo - print the information about kernel, including the location
 * of kernel entry, the start addresses of data and text segements, the start
 * address of free memory and how many memory that kernel has used.
 * */
void
print_kerninfo(void) {
c0101b15:	55                   	push   %ebp
c0101b16:	89 e5                	mov    %esp,%ebp
c0101b18:	83 ec 18             	sub    $0x18,%esp
    extern char etext[], edata[], end[], kern_init[];
    cprintf("Special kernel symbols:\n");
c0101b1b:	c7 04 24 6a b0 10 c0 	movl   $0xc010b06a,(%esp)
c0101b22:	e8 a5 fa ff ff       	call   c01015cc <cprintf>
    cprintf("  entry  0x%08x (phys)\n", kern_init);
c0101b27:	c7 44 24 04 2c 00 10 	movl   $0xc010002c,0x4(%esp)
c0101b2e:	c0 
c0101b2f:	c7 04 24 83 b0 10 c0 	movl   $0xc010b083,(%esp)
c0101b36:	e8 91 fa ff ff       	call   c01015cc <cprintf>
    cprintf("  etext  0x%08x (phys)\n", etext);
c0101b3b:	c7 44 24 04 c7 ad 10 	movl   $0xc010adc7,0x4(%esp)
c0101b42:	c0 
c0101b43:	c7 04 24 9b b0 10 c0 	movl   $0xc010b09b,(%esp)
c0101b4a:	e8 7d fa ff ff       	call   c01015cc <cprintf>
    cprintf("  edata  0x%08x (phys)\n", edata);
c0101b4f:	c7 44 24 04 a0 7a 12 	movl   $0xc0127aa0,0x4(%esp)
c0101b56:	c0 
c0101b57:	c7 04 24 b3 b0 10 c0 	movl   $0xc010b0b3,(%esp)
c0101b5e:	e8 69 fa ff ff       	call   c01015cc <cprintf>
    cprintf("  end    0x%08x (phys)\n", end);
c0101b63:	c7 44 24 04 bc 8c 12 	movl   $0xc0128cbc,0x4(%esp)
c0101b6a:	c0 
c0101b6b:	c7 04 24 cb b0 10 c0 	movl   $0xc010b0cb,(%esp)
c0101b72:	e8 55 fa ff ff       	call   c01015cc <cprintf>
    cprintf("Kernel executable memory footprint: %dKB\n", (end - kern_init + 1023)/1024);
c0101b77:	b8 bc 8c 12 c0       	mov    $0xc0128cbc,%eax
c0101b7c:	8d 90 ff 03 00 00    	lea    0x3ff(%eax),%edx
c0101b82:	b8 2c 00 10 c0       	mov    $0xc010002c,%eax
c0101b87:	89 d1                	mov    %edx,%ecx
c0101b89:	29 c1                	sub    %eax,%ecx
c0101b8b:	89 c8                	mov    %ecx,%eax
c0101b8d:	8d 90 ff 03 00 00    	lea    0x3ff(%eax),%edx
c0101b93:	85 c0                	test   %eax,%eax
c0101b95:	0f 48 c2             	cmovs  %edx,%eax
c0101b98:	c1 f8 0a             	sar    $0xa,%eax
c0101b9b:	89 44 24 04          	mov    %eax,0x4(%esp)
c0101b9f:	c7 04 24 e4 b0 10 c0 	movl   $0xc010b0e4,(%esp)
c0101ba6:	e8 21 fa ff ff       	call   c01015cc <cprintf>
}
c0101bab:	c9                   	leave  
c0101bac:	c3                   	ret    

c0101bad <print_debuginfo>:
/* *
 * print_debuginfo - read and print the stat information for the address @eip,
 * and info.eip_fn_addr should be the first address of the related function.
 * */
void
print_debuginfo(uintptr_t eip) {
c0101bad:	55                   	push   %ebp
c0101bae:	89 e5                	mov    %esp,%ebp
c0101bb0:	81 ec 48 01 00 00    	sub    $0x148,%esp
    struct eipdebuginfo info;
    if (debuginfo_eip(eip, &info) != 0) {
c0101bb6:	8d 45 dc             	lea    -0x24(%ebp),%eax
c0101bb9:	89 44 24 04          	mov    %eax,0x4(%esp)
c0101bbd:	8b 45 08             	mov    0x8(%ebp),%eax
c0101bc0:	89 04 24             	mov    %eax,(%esp)
c0101bc3:	e8 2d fc ff ff       	call   c01017f5 <debuginfo_eip>
c0101bc8:	85 c0                	test   %eax,%eax
c0101bca:	74 15                	je     c0101be1 <print_debuginfo+0x34>
        cprintf("    <unknow>: -- 0x%08x --\n", eip);
c0101bcc:	8b 45 08             	mov    0x8(%ebp),%eax
c0101bcf:	89 44 24 04          	mov    %eax,0x4(%esp)
c0101bd3:	c7 04 24 0e b1 10 c0 	movl   $0xc010b10e,(%esp)
c0101bda:	e8 ed f9 ff ff       	call   c01015cc <cprintf>
c0101bdf:	eb 68                	jmp    c0101c49 <print_debuginfo+0x9c>
    }
    else {
        char fnname[256];
        int j;
        for (j = 0; j < info.eip_fn_namelen; j ++) {
c0101be1:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
c0101be8:	eb 1a                	jmp    c0101c04 <print_debuginfo+0x57>
            fnname[j] = info.eip_fn_name[j];
c0101bea:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0101bed:	8b 4d e4             	mov    -0x1c(%ebp),%ecx
c0101bf0:	8b 55 f4             	mov    -0xc(%ebp),%edx
c0101bf3:	8d 14 11             	lea    (%ecx,%edx,1),%edx
c0101bf6:	0f b6 12             	movzbl (%edx),%edx
c0101bf9:	88 94 05 dc fe ff ff 	mov    %dl,-0x124(%ebp,%eax,1)
        cprintf("    <unknow>: -- 0x%08x --\n", eip);
    }
    else {
        char fnname[256];
        int j;
        for (j = 0; j < info.eip_fn_namelen; j ++) {
c0101c00:	83 45 f4 01          	addl   $0x1,-0xc(%ebp)
c0101c04:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0101c07:	3b 45 f4             	cmp    -0xc(%ebp),%eax
c0101c0a:	7f de                	jg     c0101bea <print_debuginfo+0x3d>
            fnname[j] = info.eip_fn_name[j];
        }
        fnname[j] = '\0';
c0101c0c:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0101c0f:	c6 84 05 dc fe ff ff 	movb   $0x0,-0x124(%ebp,%eax,1)
c0101c16:	00 
        cprintf("    %s:%d: %s+%d\n", info.eip_file, info.eip_line,
c0101c17:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0101c1a:	8b 55 08             	mov    0x8(%ebp),%edx
c0101c1d:	89 d1                	mov    %edx,%ecx
c0101c1f:	29 c1                	sub    %eax,%ecx
c0101c21:	8b 55 e0             	mov    -0x20(%ebp),%edx
c0101c24:	8b 45 dc             	mov    -0x24(%ebp),%eax
c0101c27:	89 4c 24 10          	mov    %ecx,0x10(%esp)
c0101c2b:	8d 8d dc fe ff ff    	lea    -0x124(%ebp),%ecx
c0101c31:	89 4c 24 0c          	mov    %ecx,0xc(%esp)
c0101c35:	89 54 24 08          	mov    %edx,0x8(%esp)
c0101c39:	89 44 24 04          	mov    %eax,0x4(%esp)
c0101c3d:	c7 04 24 2a b1 10 c0 	movl   $0xc010b12a,(%esp)
c0101c44:	e8 83 f9 ff ff       	call   c01015cc <cprintf>
                fnname, eip - info.eip_fn_addr);
    }
}
c0101c49:	c9                   	leave  
c0101c4a:	c3                   	ret    

c0101c4b <read_eip>:

static uint32_t read_eip(void) __attribute__((noinline));

static uint32_t
read_eip(void) {
c0101c4b:	55                   	push   %ebp
c0101c4c:	89 e5                	mov    %esp,%ebp
c0101c4e:	83 ec 10             	sub    $0x10,%esp
    uint32_t eip;
    asm volatile("movl 4(%%ebp), %0" : "=r" (eip));
c0101c51:	8b 45 04             	mov    0x4(%ebp),%eax
c0101c54:	89 45 fc             	mov    %eax,-0x4(%ebp)
    return eip;
c0101c57:	8b 45 fc             	mov    -0x4(%ebp),%eax
}
c0101c5a:	c9                   	leave  
c0101c5b:	c3                   	ret    

c0101c5c <print_stackframe>:
 *
 * Note that, the length of ebp-chain is limited. In boot/bootasm.S, before jumping
 * to the kernel entry, the value of ebp has been set to zero, that's the boundary.
 * */
void
print_stackframe(void) {
c0101c5c:	55                   	push   %ebp
c0101c5d:	89 e5                	mov    %esp,%ebp
c0101c5f:	83 ec 38             	sub    $0x38,%esp
}

static inline uint32_t
read_ebp(void) {
    uint32_t ebp;
    asm volatile ("movl %%ebp, %0" : "=r" (ebp));
c0101c62:	89 e8                	mov    %ebp,%eax
c0101c64:	89 45 f4             	mov    %eax,-0xc(%ebp)
    return ebp;
c0101c67:	8b 45 f4             	mov    -0xc(%ebp),%eax
    uint32_t ebp = read_ebp(), eip = read_eip();
c0101c6a:	89 45 e0             	mov    %eax,-0x20(%ebp)
c0101c6d:	e8 d9 ff ff ff       	call   c0101c4b <read_eip>
c0101c72:	89 45 e4             	mov    %eax,-0x1c(%ebp)

    int i, j;
    for (i = 0; ebp != 0 && i < STACKFRAME_DEPTH; i ++) {
c0101c75:	c7 45 e8 00 00 00 00 	movl   $0x0,-0x18(%ebp)
c0101c7c:	e9 82 00 00 00       	jmp    c0101d03 <print_stackframe+0xa7>
        cprintf("ebp:0x%08x eip:0x%08x args:", ebp, eip);
c0101c81:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0101c84:	89 44 24 08          	mov    %eax,0x8(%esp)
c0101c88:	8b 45 e0             	mov    -0x20(%ebp),%eax
c0101c8b:	89 44 24 04          	mov    %eax,0x4(%esp)
c0101c8f:	c7 04 24 3c b1 10 c0 	movl   $0xc010b13c,(%esp)
c0101c96:	e8 31 f9 ff ff       	call   c01015cc <cprintf>
        uint32_t *args = (uint32_t *)ebp + 2;
c0101c9b:	8b 45 e0             	mov    -0x20(%ebp),%eax
c0101c9e:	83 c0 08             	add    $0x8,%eax
c0101ca1:	89 45 f0             	mov    %eax,-0x10(%ebp)
        for (j = 0; j < 4; j ++) {
c0101ca4:	c7 45 ec 00 00 00 00 	movl   $0x0,-0x14(%ebp)
c0101cab:	eb 1f                	jmp    c0101ccc <print_stackframe+0x70>
            cprintf("0x%08x ", args[j]);
c0101cad:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0101cb0:	c1 e0 02             	shl    $0x2,%eax
c0101cb3:	03 45 f0             	add    -0x10(%ebp),%eax
c0101cb6:	8b 00                	mov    (%eax),%eax
c0101cb8:	89 44 24 04          	mov    %eax,0x4(%esp)
c0101cbc:	c7 04 24 58 b1 10 c0 	movl   $0xc010b158,(%esp)
c0101cc3:	e8 04 f9 ff ff       	call   c01015cc <cprintf>

    int i, j;
    for (i = 0; ebp != 0 && i < STACKFRAME_DEPTH; i ++) {
        cprintf("ebp:0x%08x eip:0x%08x args:", ebp, eip);
        uint32_t *args = (uint32_t *)ebp + 2;
        for (j = 0; j < 4; j ++) {
c0101cc8:	83 45 ec 01          	addl   $0x1,-0x14(%ebp)
c0101ccc:	83 7d ec 03          	cmpl   $0x3,-0x14(%ebp)
c0101cd0:	7e db                	jle    c0101cad <print_stackframe+0x51>
            cprintf("0x%08x ", args[j]);
        }
        cprintf("\n");
c0101cd2:	c7 04 24 60 b1 10 c0 	movl   $0xc010b160,(%esp)
c0101cd9:	e8 ee f8 ff ff       	call   c01015cc <cprintf>
        print_debuginfo(eip - 1);
c0101cde:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0101ce1:	83 e8 01             	sub    $0x1,%eax
c0101ce4:	89 04 24             	mov    %eax,(%esp)
c0101ce7:	e8 c1 fe ff ff       	call   c0101bad <print_debuginfo>
        eip = ((uint32_t *)ebp)[1];
c0101cec:	8b 45 e0             	mov    -0x20(%ebp),%eax
c0101cef:	83 c0 04             	add    $0x4,%eax
c0101cf2:	8b 00                	mov    (%eax),%eax
c0101cf4:	89 45 e4             	mov    %eax,-0x1c(%ebp)
        ebp = ((uint32_t *)ebp)[0];
c0101cf7:	8b 45 e0             	mov    -0x20(%ebp),%eax
c0101cfa:	8b 00                	mov    (%eax),%eax
c0101cfc:	89 45 e0             	mov    %eax,-0x20(%ebp)
void
print_stackframe(void) {
    uint32_t ebp = read_ebp(), eip = read_eip();

    int i, j;
    for (i = 0; ebp != 0 && i < STACKFRAME_DEPTH; i ++) {
c0101cff:	83 45 e8 01          	addl   $0x1,-0x18(%ebp)
c0101d03:	83 7d e0 00          	cmpl   $0x0,-0x20(%ebp)
c0101d07:	74 0a                	je     c0101d13 <print_stackframe+0xb7>
c0101d09:	83 7d e8 13          	cmpl   $0x13,-0x18(%ebp)
c0101d0d:	0f 8e 6e ff ff ff    	jle    c0101c81 <print_stackframe+0x25>
        cprintf("\n");
        print_debuginfo(eip - 1);
        eip = ((uint32_t *)ebp)[1];
        ebp = ((uint32_t *)ebp)[0];
    }
}
c0101d13:	c9                   	leave  
c0101d14:	c3                   	ret    

c0101d15 <save_all_dr>:

static unsigned int local_dr_counter[MAX_DR_NUM];

/* save_all_dr - save all debug registers to memory and then disable them */
static void
save_all_dr(void) {
c0101d15:	55                   	push   %ebp
c0101d16:	89 e5                	mov    %esp,%ebp
c0101d18:	53                   	push   %ebx
c0101d19:	83 ec 30             	sub    $0x30,%esp
    int i;
    for (i = 0; i < MAX_DR_NUM; i ++) {
c0101d1c:	c7 45 d4 00 00 00 00 	movl   $0x0,-0x2c(%ebp)
c0101d23:	eb 60                	jmp    c0101d85 <save_all_dr+0x70>
        local_dr[i] = read_dr(i);
c0101d25:	8b 45 d4             	mov    -0x2c(%ebp),%eax
c0101d28:	8b 55 d4             	mov    -0x2c(%ebp),%edx
c0101d2b:	89 55 dc             	mov    %edx,-0x24(%ebp)
    asm volatile ("int $3");
}

static inline uint32_t
read_dr(unsigned regnum) {
    uint32_t value = 0;
c0101d2e:	c7 45 e0 00 00 00 00 	movl   $0x0,-0x20(%ebp)
    switch (regnum) {
c0101d35:	83 7d dc 07          	cmpl   $0x7,-0x24(%ebp)
c0101d39:	77 3c                	ja     c0101d77 <save_all_dr+0x62>
c0101d3b:	8b 55 dc             	mov    -0x24(%ebp),%edx
c0101d3e:	c1 e2 02             	shl    $0x2,%edx
c0101d41:	8b 92 64 b1 10 c0    	mov    -0x3fef4e9c(%edx),%edx
c0101d47:	ff e2                	jmp    *%edx
    case 0: asm volatile ("movl %%db0, %0" : "=r" (value)); break;
c0101d49:	0f 21 c2             	mov    %db0,%edx
c0101d4c:	89 55 e0             	mov    %edx,-0x20(%ebp)
c0101d4f:	eb 26                	jmp    c0101d77 <save_all_dr+0x62>
    case 1: asm volatile ("movl %%db1, %0" : "=r" (value)); break;
c0101d51:	0f 21 ca             	mov    %db1,%edx
c0101d54:	89 55 e0             	mov    %edx,-0x20(%ebp)
c0101d57:	eb 1e                	jmp    c0101d77 <save_all_dr+0x62>
    case 2: asm volatile ("movl %%db2, %0" : "=r" (value)); break;
c0101d59:	0f 21 d2             	mov    %db2,%edx
c0101d5c:	89 55 e0             	mov    %edx,-0x20(%ebp)
c0101d5f:	eb 16                	jmp    c0101d77 <save_all_dr+0x62>
    case 3: asm volatile ("movl %%db3, %0" : "=r" (value)); break;
c0101d61:	0f 21 da             	mov    %db3,%edx
c0101d64:	89 55 e0             	mov    %edx,-0x20(%ebp)
c0101d67:	eb 0e                	jmp    c0101d77 <save_all_dr+0x62>
    case 6: asm volatile ("movl %%db6, %0" : "=r" (value)); break;
c0101d69:	0f 21 f2             	mov    %db6,%edx
c0101d6c:	89 55 e0             	mov    %edx,-0x20(%ebp)
c0101d6f:	eb 06                	jmp    c0101d77 <save_all_dr+0x62>
    case 7: asm volatile ("movl %%db7, %0" : "=r" (value)); break;
c0101d71:	0f 21 fa             	mov    %db7,%edx
c0101d74:	89 55 e0             	mov    %edx,-0x20(%ebp)
    }
    return value;
c0101d77:	8b 55 e0             	mov    -0x20(%ebp),%edx
c0101d7a:	89 14 85 a0 7e 12 c0 	mov    %edx,-0x3fed8160(,%eax,4)

/* save_all_dr - save all debug registers to memory and then disable them */
static void
save_all_dr(void) {
    int i;
    for (i = 0; i < MAX_DR_NUM; i ++) {
c0101d81:	83 45 d4 01          	addl   $0x1,-0x2c(%ebp)
c0101d85:	83 7d d4 03          	cmpl   $0x3,-0x2c(%ebp)
c0101d89:	7e 9a                	jle    c0101d25 <save_all_dr+0x10>
c0101d8b:	c7 45 e4 06 00 00 00 	movl   $0x6,-0x1c(%ebp)
    asm volatile ("int $3");
}

static inline uint32_t
read_dr(unsigned regnum) {
    uint32_t value = 0;
c0101d92:	c7 45 e8 00 00 00 00 	movl   $0x0,-0x18(%ebp)
    switch (regnum) {
c0101d99:	83 7d e4 07          	cmpl   $0x7,-0x1c(%ebp)
c0101d9d:	77 3c                	ja     c0101ddb <save_all_dr+0xc6>
c0101d9f:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0101da2:	c1 e0 02             	shl    $0x2,%eax
c0101da5:	8b 80 84 b1 10 c0    	mov    -0x3fef4e7c(%eax),%eax
c0101dab:	ff e0                	jmp    *%eax
    case 0: asm volatile ("movl %%db0, %0" : "=r" (value)); break;
c0101dad:	0f 21 c0             	mov    %db0,%eax
c0101db0:	89 45 e8             	mov    %eax,-0x18(%ebp)
c0101db3:	eb 26                	jmp    c0101ddb <save_all_dr+0xc6>
    case 1: asm volatile ("movl %%db1, %0" : "=r" (value)); break;
c0101db5:	0f 21 c8             	mov    %db1,%eax
c0101db8:	89 45 e8             	mov    %eax,-0x18(%ebp)
c0101dbb:	eb 1e                	jmp    c0101ddb <save_all_dr+0xc6>
    case 2: asm volatile ("movl %%db2, %0" : "=r" (value)); break;
c0101dbd:	0f 21 d0             	mov    %db2,%eax
c0101dc0:	89 45 e8             	mov    %eax,-0x18(%ebp)
c0101dc3:	eb 16                	jmp    c0101ddb <save_all_dr+0xc6>
    case 3: asm volatile ("movl %%db3, %0" : "=r" (value)); break;
c0101dc5:	0f 21 d8             	mov    %db3,%eax
c0101dc8:	89 45 e8             	mov    %eax,-0x18(%ebp)
c0101dcb:	eb 0e                	jmp    c0101ddb <save_all_dr+0xc6>
    case 6: asm volatile ("movl %%db6, %0" : "=r" (value)); break;
c0101dcd:	0f 21 f0             	mov    %db6,%eax
c0101dd0:	89 45 e8             	mov    %eax,-0x18(%ebp)
c0101dd3:	eb 06                	jmp    c0101ddb <save_all_dr+0xc6>
    case 7: asm volatile ("movl %%db7, %0" : "=r" (value)); break;
c0101dd5:	0f 21 f8             	mov    %db7,%eax
c0101dd8:	89 45 e8             	mov    %eax,-0x18(%ebp)
    }
    return value;
c0101ddb:	8b 45 e8             	mov    -0x18(%ebp),%eax
        local_dr[i] = read_dr(i);
    }
    status_dr = read_dr(DR_STATUS);
c0101dde:	a3 b0 7e 12 c0       	mov    %eax,0xc0127eb0
c0101de3:	c7 45 ec 07 00 00 00 	movl   $0x7,-0x14(%ebp)
    asm volatile ("int $3");
}

static inline uint32_t
read_dr(unsigned regnum) {
    uint32_t value = 0;
c0101dea:	c7 45 f0 00 00 00 00 	movl   $0x0,-0x10(%ebp)
    switch (regnum) {
c0101df1:	83 7d ec 07          	cmpl   $0x7,-0x14(%ebp)
c0101df5:	77 3c                	ja     c0101e33 <save_all_dr+0x11e>
c0101df7:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0101dfa:	c1 e0 02             	shl    $0x2,%eax
c0101dfd:	8b 80 a4 b1 10 c0    	mov    -0x3fef4e5c(%eax),%eax
c0101e03:	ff e0                	jmp    *%eax
    case 0: asm volatile ("movl %%db0, %0" : "=r" (value)); break;
c0101e05:	0f 21 c0             	mov    %db0,%eax
c0101e08:	89 45 f0             	mov    %eax,-0x10(%ebp)
c0101e0b:	eb 26                	jmp    c0101e33 <save_all_dr+0x11e>
    case 1: asm volatile ("movl %%db1, %0" : "=r" (value)); break;
c0101e0d:	0f 21 c8             	mov    %db1,%eax
c0101e10:	89 45 f0             	mov    %eax,-0x10(%ebp)
c0101e13:	eb 1e                	jmp    c0101e33 <save_all_dr+0x11e>
    case 2: asm volatile ("movl %%db2, %0" : "=r" (value)); break;
c0101e15:	0f 21 d0             	mov    %db2,%eax
c0101e18:	89 45 f0             	mov    %eax,-0x10(%ebp)
c0101e1b:	eb 16                	jmp    c0101e33 <save_all_dr+0x11e>
    case 3: asm volatile ("movl %%db3, %0" : "=r" (value)); break;
c0101e1d:	0f 21 d8             	mov    %db3,%eax
c0101e20:	89 45 f0             	mov    %eax,-0x10(%ebp)
c0101e23:	eb 0e                	jmp    c0101e33 <save_all_dr+0x11e>
    case 6: asm volatile ("movl %%db6, %0" : "=r" (value)); break;
c0101e25:	0f 21 f0             	mov    %db6,%eax
c0101e28:	89 45 f0             	mov    %eax,-0x10(%ebp)
c0101e2b:	eb 06                	jmp    c0101e33 <save_all_dr+0x11e>
    case 7: asm volatile ("movl %%db7, %0" : "=r" (value)); break;
c0101e2d:	0f 21 f8             	mov    %db7,%eax
c0101e30:	89 45 f0             	mov    %eax,-0x10(%ebp)
    }
    return value;
c0101e33:	8b 45 f0             	mov    -0x10(%ebp),%eax
    control_dr = read_dr(DR_CONTROL);
c0101e36:	a3 b4 7e 12 c0       	mov    %eax,0xc0127eb4
c0101e3b:	c7 45 f8 07 00 00 00 	movl   $0x7,-0x8(%ebp)
c0101e42:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
}

static void
write_dr(unsigned regnum, uint32_t value) {
    switch (regnum) {
c0101e49:	83 7d f8 07          	cmpl   $0x7,-0x8(%ebp)
c0101e4d:	77 3c                	ja     c0101e8b <save_all_dr+0x176>
c0101e4f:	8b 45 f8             	mov    -0x8(%ebp),%eax
c0101e52:	c1 e0 02             	shl    $0x2,%eax
c0101e55:	8b 80 c4 b1 10 c0    	mov    -0x3fef4e3c(%eax),%eax
c0101e5b:	ff e0                	jmp    *%eax
    case 0: asm volatile ("movl %0, %%db0" :: "r" (value)); break;
c0101e5d:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0101e60:	0f 23 c0             	mov    %eax,%db0
c0101e63:	eb 26                	jmp    c0101e8b <save_all_dr+0x176>
    case 1: asm volatile ("movl %0, %%db1" :: "r" (value)); break;
c0101e65:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0101e68:	0f 23 c8             	mov    %eax,%db1
c0101e6b:	eb 1e                	jmp    c0101e8b <save_all_dr+0x176>
    case 2: asm volatile ("movl %0, %%db2" :: "r" (value)); break;
c0101e6d:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0101e70:	0f 23 d0             	mov    %eax,%db2
c0101e73:	eb 16                	jmp    c0101e8b <save_all_dr+0x176>
    case 3: asm volatile ("movl %0, %%db3" :: "r" (value)); break;
c0101e75:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0101e78:	0f 23 d8             	mov    %eax,%db3
c0101e7b:	eb 0e                	jmp    c0101e8b <save_all_dr+0x176>
    case 6: asm volatile ("movl %0, %%db6" :: "r" (value)); break;
c0101e7d:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0101e80:	0f 23 f0             	mov    %eax,%db6
c0101e83:	eb 06                	jmp    c0101e8b <save_all_dr+0x176>
    case 7: asm volatile ("movl %0, %%db7" :: "r" (value)); break;
c0101e85:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0101e88:	0f 23 f8             	mov    %eax,%db7
    // disable breakpoints while debugger is running
    write_dr(DR_CONTROL, 0);

    // increase Debug Register Counter
    unsigned regnum;
    for (regnum = 0; regnum < MAX_DR_NUM; regnum ++) {
c0101e8b:	c7 45 d8 00 00 00 00 	movl   $0x0,-0x28(%ebp)
c0101e92:	eb 35                	jmp    c0101ec9 <save_all_dr+0x1b4>
        if (status_dr & (1 << regnum)) {
c0101e94:	8b 45 d8             	mov    -0x28(%ebp),%eax
c0101e97:	ba 01 00 00 00       	mov    $0x1,%edx
c0101e9c:	89 d3                	mov    %edx,%ebx
c0101e9e:	89 c1                	mov    %eax,%ecx
c0101ea0:	d3 e3                	shl    %cl,%ebx
c0101ea2:	89 d8                	mov    %ebx,%eax
c0101ea4:	89 c2                	mov    %eax,%edx
c0101ea6:	a1 b0 7e 12 c0       	mov    0xc0127eb0,%eax
c0101eab:	21 d0                	and    %edx,%eax
c0101ead:	85 c0                	test   %eax,%eax
c0101eaf:	74 14                	je     c0101ec5 <save_all_dr+0x1b0>
            local_dr_counter[regnum] ++;
c0101eb1:	8b 45 d8             	mov    -0x28(%ebp),%eax
c0101eb4:	8b 14 85 b8 7e 12 c0 	mov    -0x3fed8148(,%eax,4),%edx
c0101ebb:	83 c2 01             	add    $0x1,%edx
c0101ebe:	89 14 85 b8 7e 12 c0 	mov    %edx,-0x3fed8148(,%eax,4)
    // disable breakpoints while debugger is running
    write_dr(DR_CONTROL, 0);

    // increase Debug Register Counter
    unsigned regnum;
    for (regnum = 0; regnum < MAX_DR_NUM; regnum ++) {
c0101ec5:	83 45 d8 01          	addl   $0x1,-0x28(%ebp)
c0101ec9:	83 7d d8 03          	cmpl   $0x3,-0x28(%ebp)
c0101ecd:	76 c5                	jbe    c0101e94 <save_all_dr+0x17f>
        if (status_dr & (1 << regnum)) {
            local_dr_counter[regnum] ++;
        }
    }
}
c0101ecf:	83 c4 30             	add    $0x30,%esp
c0101ed2:	5b                   	pop    %ebx
c0101ed3:	5d                   	pop    %ebp
c0101ed4:	c3                   	ret    

c0101ed5 <restore_all_dr>:

/* restore_all_dr - reset all debug registers and clear the status register DR6 */
static void
restore_all_dr(void) {
c0101ed5:	55                   	push   %ebp
c0101ed6:	89 e5                	mov    %esp,%ebp
c0101ed8:	83 ec 20             	sub    $0x20,%esp
    int i;
    for (i = 0; i < MAX_DR_NUM; i ++) {
c0101edb:	c7 45 e4 00 00 00 00 	movl   $0x0,-0x1c(%ebp)
c0101ee2:	eb 59                	jmp    c0101f3d <restore_all_dr+0x68>
        write_dr(i, local_dr[i]);
c0101ee4:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0101ee7:	8b 04 85 a0 7e 12 c0 	mov    -0x3fed8160(,%eax,4),%eax
c0101eee:	8b 55 e4             	mov    -0x1c(%ebp),%edx
c0101ef1:	89 55 ec             	mov    %edx,-0x14(%ebp)
c0101ef4:	89 45 e8             	mov    %eax,-0x18(%ebp)
    return value;
}

static void
write_dr(unsigned regnum, uint32_t value) {
    switch (regnum) {
c0101ef7:	83 7d ec 07          	cmpl   $0x7,-0x14(%ebp)
c0101efb:	77 3c                	ja     c0101f39 <restore_all_dr+0x64>
c0101efd:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0101f00:	c1 e0 02             	shl    $0x2,%eax
c0101f03:	8b 80 e4 b1 10 c0    	mov    -0x3fef4e1c(%eax),%eax
c0101f09:	ff e0                	jmp    *%eax
    case 0: asm volatile ("movl %0, %%db0" :: "r" (value)); break;
c0101f0b:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0101f0e:	0f 23 c0             	mov    %eax,%db0
c0101f11:	eb 26                	jmp    c0101f39 <restore_all_dr+0x64>
    case 1: asm volatile ("movl %0, %%db1" :: "r" (value)); break;
c0101f13:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0101f16:	0f 23 c8             	mov    %eax,%db1
c0101f19:	eb 1e                	jmp    c0101f39 <restore_all_dr+0x64>
    case 2: asm volatile ("movl %0, %%db2" :: "r" (value)); break;
c0101f1b:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0101f1e:	0f 23 d0             	mov    %eax,%db2
c0101f21:	eb 16                	jmp    c0101f39 <restore_all_dr+0x64>
    case 3: asm volatile ("movl %0, %%db3" :: "r" (value)); break;
c0101f23:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0101f26:	0f 23 d8             	mov    %eax,%db3
c0101f29:	eb 0e                	jmp    c0101f39 <restore_all_dr+0x64>
    case 6: asm volatile ("movl %0, %%db6" :: "r" (value)); break;
c0101f2b:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0101f2e:	0f 23 f0             	mov    %eax,%db6
c0101f31:	eb 06                	jmp    c0101f39 <restore_all_dr+0x64>
    case 7: asm volatile ("movl %0, %%db7" :: "r" (value)); break;
c0101f33:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0101f36:	0f 23 f8             	mov    %eax,%db7

/* restore_all_dr - reset all debug registers and clear the status register DR6 */
static void
restore_all_dr(void) {
    int i;
    for (i = 0; i < MAX_DR_NUM; i ++) {
c0101f39:	83 45 e4 01          	addl   $0x1,-0x1c(%ebp)
c0101f3d:	83 7d e4 03          	cmpl   $0x3,-0x1c(%ebp)
c0101f41:	7e a1                	jle    c0101ee4 <restore_all_dr+0xf>
c0101f43:	c7 45 f4 06 00 00 00 	movl   $0x6,-0xc(%ebp)
c0101f4a:	c7 45 f0 00 00 00 00 	movl   $0x0,-0x10(%ebp)
    return value;
}

static void
write_dr(unsigned regnum, uint32_t value) {
    switch (regnum) {
c0101f51:	83 7d f4 07          	cmpl   $0x7,-0xc(%ebp)
c0101f55:	77 3c                	ja     c0101f93 <restore_all_dr+0xbe>
c0101f57:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0101f5a:	c1 e0 02             	shl    $0x2,%eax
c0101f5d:	8b 80 04 b2 10 c0    	mov    -0x3fef4dfc(%eax),%eax
c0101f63:	ff e0                	jmp    *%eax
    case 0: asm volatile ("movl %0, %%db0" :: "r" (value)); break;
c0101f65:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0101f68:	0f 23 c0             	mov    %eax,%db0
c0101f6b:	eb 26                	jmp    c0101f93 <restore_all_dr+0xbe>
    case 1: asm volatile ("movl %0, %%db1" :: "r" (value)); break;
c0101f6d:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0101f70:	0f 23 c8             	mov    %eax,%db1
c0101f73:	eb 1e                	jmp    c0101f93 <restore_all_dr+0xbe>
    case 2: asm volatile ("movl %0, %%db2" :: "r" (value)); break;
c0101f75:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0101f78:	0f 23 d0             	mov    %eax,%db2
c0101f7b:	eb 16                	jmp    c0101f93 <restore_all_dr+0xbe>
    case 3: asm volatile ("movl %0, %%db3" :: "r" (value)); break;
c0101f7d:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0101f80:	0f 23 d8             	mov    %eax,%db3
c0101f83:	eb 0e                	jmp    c0101f93 <restore_all_dr+0xbe>
    case 6: asm volatile ("movl %0, %%db6" :: "r" (value)); break;
c0101f85:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0101f88:	0f 23 f0             	mov    %eax,%db6
c0101f8b:	eb 06                	jmp    c0101f93 <restore_all_dr+0xbe>
    case 7: asm volatile ("movl %0, %%db7" :: "r" (value)); break;
c0101f8d:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0101f90:	0f 23 f8             	mov    %eax,%db7
        write_dr(i, local_dr[i]);
    }
    write_dr(DR_STATUS, 0);
    write_dr(DR_CONTROL, control_dr);
c0101f93:	a1 b4 7e 12 c0       	mov    0xc0127eb4,%eax
c0101f98:	c7 45 fc 07 00 00 00 	movl   $0x7,-0x4(%ebp)
c0101f9f:	89 45 f8             	mov    %eax,-0x8(%ebp)
    return value;
}

static void
write_dr(unsigned regnum, uint32_t value) {
    switch (regnum) {
c0101fa2:	83 7d fc 07          	cmpl   $0x7,-0x4(%ebp)
c0101fa6:	77 3c                	ja     c0101fe4 <restore_all_dr+0x10f>
c0101fa8:	8b 45 fc             	mov    -0x4(%ebp),%eax
c0101fab:	c1 e0 02             	shl    $0x2,%eax
c0101fae:	8b 80 24 b2 10 c0    	mov    -0x3fef4ddc(%eax),%eax
c0101fb4:	ff e0                	jmp    *%eax
    case 0: asm volatile ("movl %0, %%db0" :: "r" (value)); break;
c0101fb6:	8b 45 f8             	mov    -0x8(%ebp),%eax
c0101fb9:	0f 23 c0             	mov    %eax,%db0
c0101fbc:	eb 26                	jmp    c0101fe4 <restore_all_dr+0x10f>
    case 1: asm volatile ("movl %0, %%db1" :: "r" (value)); break;
c0101fbe:	8b 45 f8             	mov    -0x8(%ebp),%eax
c0101fc1:	0f 23 c8             	mov    %eax,%db1
c0101fc4:	eb 1e                	jmp    c0101fe4 <restore_all_dr+0x10f>
    case 2: asm volatile ("movl %0, %%db2" :: "r" (value)); break;
c0101fc6:	8b 45 f8             	mov    -0x8(%ebp),%eax
c0101fc9:	0f 23 d0             	mov    %eax,%db2
c0101fcc:	eb 16                	jmp    c0101fe4 <restore_all_dr+0x10f>
    case 3: asm volatile ("movl %0, %%db3" :: "r" (value)); break;
c0101fce:	8b 45 f8             	mov    -0x8(%ebp),%eax
c0101fd1:	0f 23 d8             	mov    %eax,%db3
c0101fd4:	eb 0e                	jmp    c0101fe4 <restore_all_dr+0x10f>
    case 6: asm volatile ("movl %0, %%db6" :: "r" (value)); break;
c0101fd6:	8b 45 f8             	mov    -0x8(%ebp),%eax
c0101fd9:	0f 23 f0             	mov    %eax,%db6
c0101fdc:	eb 06                	jmp    c0101fe4 <restore_all_dr+0x10f>
    case 7: asm volatile ("movl %0, %%db7" :: "r" (value)); break;
c0101fde:	8b 45 f8             	mov    -0x8(%ebp),%eax
c0101fe1:	0f 23 f8             	mov    %eax,%db7
}
c0101fe4:	c9                   	leave  
c0101fe5:	c3                   	ret    

c0101fe6 <debug_enable_dr>:

/* debug_enable_dr - set and enable debug register @regnum locally */
int
debug_enable_dr(unsigned regnum, uintptr_t addr, unsigned type, unsigned len) {
c0101fe6:	55                   	push   %ebp
c0101fe7:	89 e5                	mov    %esp,%ebp
c0101fe9:	53                   	push   %ebx
c0101fea:	83 ec 10             	sub    $0x10,%esp
    if (regnum < MAX_DR_NUM) {
c0101fed:	83 7d 08 03          	cmpl   $0x3,0x8(%ebp)
c0101ff1:	0f 87 ad 00 00 00    	ja     c01020a4 <debug_enable_dr+0xbe>
        local_dr[regnum] = addr;
c0101ff7:	8b 45 08             	mov    0x8(%ebp),%eax
c0101ffa:	8b 55 0c             	mov    0xc(%ebp),%edx
c0101ffd:	89 14 85 a0 7e 12 c0 	mov    %edx,-0x3fed8160(,%eax,4)
        local_dr_counter[regnum] = 0;
c0102004:	8b 45 08             	mov    0x8(%ebp),%eax
c0102007:	c7 04 85 b8 7e 12 c0 	movl   $0x0,-0x3fed8148(,%eax,4)
c010200e:	00 00 00 00 
        unsigned shift = (regnum * 4) + 16;
c0102012:	8b 45 08             	mov    0x8(%ebp),%eax
c0102015:	83 c0 04             	add    $0x4,%eax
c0102018:	c1 e0 02             	shl    $0x2,%eax
c010201b:	89 45 f4             	mov    %eax,-0xc(%ebp)
        uint32_t mask = (0xF << shift);
c010201e:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0102021:	ba 0f 00 00 00       	mov    $0xf,%edx
c0102026:	89 d3                	mov    %edx,%ebx
c0102028:	89 c1                	mov    %eax,%ecx
c010202a:	d3 e3                	shl    %cl,%ebx
c010202c:	89 d8                	mov    %ebx,%eax
c010202e:	89 45 f8             	mov    %eax,-0x8(%ebp)
        control_dr &= ~mask;
c0102031:	8b 45 f8             	mov    -0x8(%ebp),%eax
c0102034:	89 c2                	mov    %eax,%edx
c0102036:	f7 d2                	not    %edx
c0102038:	a1 b4 7e 12 c0       	mov    0xc0127eb4,%eax
c010203d:	21 d0                	and    %edx,%eax
c010203f:	a3 b4 7e 12 c0       	mov    %eax,0xc0127eb4
        control_dr |= ((type & 3) << shift);
c0102044:	8b 45 10             	mov    0x10(%ebp),%eax
c0102047:	89 c2                	mov    %eax,%edx
c0102049:	83 e2 03             	and    $0x3,%edx
c010204c:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010204f:	89 c1                	mov    %eax,%ecx
c0102051:	d3 e2                	shl    %cl,%edx
c0102053:	a1 b4 7e 12 c0       	mov    0xc0127eb4,%eax
c0102058:	09 d0                	or     %edx,%eax
c010205a:	a3 b4 7e 12 c0       	mov    %eax,0xc0127eb4
        control_dr |= ((len & 3) << (shift + 2));
c010205f:	8b 45 14             	mov    0x14(%ebp),%eax
c0102062:	89 c2                	mov    %eax,%edx
c0102064:	83 e2 03             	and    $0x3,%edx
c0102067:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010206a:	83 c0 02             	add    $0x2,%eax
c010206d:	89 c1                	mov    %eax,%ecx
c010206f:	d3 e2                	shl    %cl,%edx
c0102071:	a1 b4 7e 12 c0       	mov    0xc0127eb4,%eax
c0102076:	09 d0                	or     %edx,%eax
c0102078:	a3 b4 7e 12 c0       	mov    %eax,0xc0127eb4
        control_dr |= (1 << (regnum * 2));
c010207d:	8b 45 08             	mov    0x8(%ebp),%eax
c0102080:	01 c0                	add    %eax,%eax
c0102082:	ba 01 00 00 00       	mov    $0x1,%edx
c0102087:	89 d3                	mov    %edx,%ebx
c0102089:	89 c1                	mov    %eax,%ecx
c010208b:	d3 e3                	shl    %cl,%ebx
c010208d:	89 d8                	mov    %ebx,%eax
c010208f:	89 c2                	mov    %eax,%edx
c0102091:	a1 b4 7e 12 c0       	mov    0xc0127eb4,%eax
c0102096:	09 d0                	or     %edx,%eax
c0102098:	a3 b4 7e 12 c0       	mov    %eax,0xc0127eb4
        return 0;
c010209d:	b8 00 00 00 00       	mov    $0x0,%eax
c01020a2:	eb 05                	jmp    c01020a9 <debug_enable_dr+0xc3>
    }
    return -1;
c01020a4:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
}
c01020a9:	83 c4 10             	add    $0x10,%esp
c01020ac:	5b                   	pop    %ebx
c01020ad:	5d                   	pop    %ebp
c01020ae:	c3                   	ret    

c01020af <debug_disable_dr>:

/* debug_disable_dr - disable debug register @regnum locally */
int
debug_disable_dr(unsigned regnum) {
c01020af:	55                   	push   %ebp
c01020b0:	89 e5                	mov    %esp,%ebp
c01020b2:	53                   	push   %ebx
c01020b3:	83 ec 10             	sub    $0x10,%esp
    if (regnum < MAX_DR_NUM) {
c01020b6:	83 7d 08 03          	cmpl   $0x3,0x8(%ebp)
c01020ba:	77 5b                	ja     c0102117 <debug_disable_dr+0x68>
        unsigned shift = (regnum * 4) + 16;
c01020bc:	8b 45 08             	mov    0x8(%ebp),%eax
c01020bf:	83 c0 04             	add    $0x4,%eax
c01020c2:	c1 e0 02             	shl    $0x2,%eax
c01020c5:	89 45 f4             	mov    %eax,-0xc(%ebp)
        uint32_t mask = (0xF << shift);
c01020c8:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01020cb:	ba 0f 00 00 00       	mov    $0xf,%edx
c01020d0:	89 d3                	mov    %edx,%ebx
c01020d2:	89 c1                	mov    %eax,%ecx
c01020d4:	d3 e3                	shl    %cl,%ebx
c01020d6:	89 d8                	mov    %ebx,%eax
c01020d8:	89 45 f8             	mov    %eax,-0x8(%ebp)
        control_dr &= ~mask;
c01020db:	8b 45 f8             	mov    -0x8(%ebp),%eax
c01020de:	89 c2                	mov    %eax,%edx
c01020e0:	f7 d2                	not    %edx
c01020e2:	a1 b4 7e 12 c0       	mov    0xc0127eb4,%eax
c01020e7:	21 d0                	and    %edx,%eax
c01020e9:	a3 b4 7e 12 c0       	mov    %eax,0xc0127eb4
        control_dr &= ~(1 << (regnum * 2));
c01020ee:	8b 45 08             	mov    0x8(%ebp),%eax
c01020f1:	01 c0                	add    %eax,%eax
c01020f3:	ba 01 00 00 00       	mov    $0x1,%edx
c01020f8:	89 d3                	mov    %edx,%ebx
c01020fa:	89 c1                	mov    %eax,%ecx
c01020fc:	d3 e3                	shl    %cl,%ebx
c01020fe:	89 d8                	mov    %ebx,%eax
c0102100:	f7 d0                	not    %eax
c0102102:	89 c2                	mov    %eax,%edx
c0102104:	a1 b4 7e 12 c0       	mov    0xc0127eb4,%eax
c0102109:	21 d0                	and    %edx,%eax
c010210b:	a3 b4 7e 12 c0       	mov    %eax,0xc0127eb4
        return 0;
c0102110:	b8 00 00 00 00       	mov    $0x0,%eax
c0102115:	eb 05                	jmp    c010211c <debug_disable_dr+0x6d>
    }
    return -1;
c0102117:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
}
c010211c:	83 c4 10             	add    $0x10,%esp
c010211f:	5b                   	pop    %ebx
c0102120:	5d                   	pop    %ebp
c0102121:	c3                   	ret    

c0102122 <debug_init>:
// mark if local_dr, status_dr and contorl_dr are valid
static bool is_dr_saved = 0;

/* debug_init - init all debug registers by using restore_dr */
void
debug_init(void) {
c0102122:	55                   	push   %ebp
c0102123:	89 e5                	mov    %esp,%ebp
c0102125:	83 ec 18             	sub    $0x18,%esp
    memset(local_dr, 0, sizeof(local_dr));
c0102128:	c7 44 24 08 10 00 00 	movl   $0x10,0x8(%esp)
c010212f:	00 
c0102130:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
c0102137:	00 
c0102138:	c7 04 24 a0 7e 12 c0 	movl   $0xc0127ea0,(%esp)
c010213f:	e8 ff 8a 00 00       	call   c010ac43 <memset>
    memset(local_dr_counter, 0, sizeof(local_dr_counter));
c0102144:	c7 44 24 08 10 00 00 	movl   $0x10,0x8(%esp)
c010214b:	00 
c010214c:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
c0102153:	00 
c0102154:	c7 04 24 b8 7e 12 c0 	movl   $0xc0127eb8,(%esp)
c010215b:	e8 e3 8a 00 00       	call   c010ac43 <memset>
    control_dr = DR7_GEXACT | DR7_LEXACT;
c0102160:	c7 05 b4 7e 12 c0 00 	movl   $0x300,0xc0127eb4
c0102167:	03 00 00 
    restore_all_dr();
c010216a:	e8 66 fd ff ff       	call   c0101ed5 <restore_all_dr>
}
c010216f:	c9                   	leave  
c0102170:	c3                   	ret    

c0102171 <debug_list_dr>:

/* debug_list_dr - list and print all debug registrs' value and type */
void
debug_list_dr(void) {
c0102171:	55                   	push   %ebp
c0102172:	89 e5                	mov    %esp,%ebp
c0102174:	53                   	push   %ebx
c0102175:	83 ec 44             	sub    $0x44,%esp
    bool has = 0;
c0102178:	c7 45 e4 00 00 00 00 	movl   $0x0,-0x1c(%ebp)
    int regnum;
    for (regnum = 0; regnum < MAX_DR_NUM; regnum ++) {
c010217f:	c7 45 e8 00 00 00 00 	movl   $0x0,-0x18(%ebp)
c0102186:	e9 c8 00 00 00       	jmp    c0102253 <debug_list_dr+0xe2>
        if (control_dr & (1 << (regnum * 2))) {
c010218b:	8b 45 e8             	mov    -0x18(%ebp),%eax
c010218e:	01 c0                	add    %eax,%eax
c0102190:	ba 01 00 00 00       	mov    $0x1,%edx
c0102195:	89 d3                	mov    %edx,%ebx
c0102197:	89 c1                	mov    %eax,%ecx
c0102199:	d3 e3                	shl    %cl,%ebx
c010219b:	89 d8                	mov    %ebx,%eax
c010219d:	89 c2                	mov    %eax,%edx
c010219f:	a1 b4 7e 12 c0       	mov    0xc0127eb4,%eax
c01021a4:	21 d0                	and    %edx,%eax
c01021a6:	85 c0                	test   %eax,%eax
c01021a8:	0f 84 a1 00 00 00    	je     c010224f <debug_list_dr+0xde>
            if (!has) {
c01021ae:	83 7d e4 00          	cmpl   $0x0,-0x1c(%ebp)
c01021b2:	75 13                	jne    c01021c7 <debug_list_dr+0x56>
                has = 1;
c01021b4:	c7 45 e4 01 00 00 00 	movl   $0x1,-0x1c(%ebp)
                cprintf("    Num Address    Type       Len    Count\n");
c01021bb:	c7 04 24 80 b2 10 c0 	movl   $0xc010b280,(%esp)
c01021c2:	e8 05 f4 ff ff       	call   c01015cc <cprintf>
            }
            unsigned shift = (regnum * 4) + 16;
c01021c7:	8b 45 e8             	mov    -0x18(%ebp),%eax
c01021ca:	83 c0 04             	add    $0x4,%eax
c01021cd:	c1 e0 02             	shl    $0x2,%eax
c01021d0:	89 45 ec             	mov    %eax,-0x14(%ebp)
            unsigned type = ((control_dr >> shift) & 3);
c01021d3:	8b 15 b4 7e 12 c0    	mov    0xc0127eb4,%edx
c01021d9:	8b 45 ec             	mov    -0x14(%ebp),%eax
c01021dc:	89 d3                	mov    %edx,%ebx
c01021de:	89 c1                	mov    %eax,%ecx
c01021e0:	d3 eb                	shr    %cl,%ebx
c01021e2:	89 d8                	mov    %ebx,%eax
c01021e4:	83 e0 03             	and    $0x3,%eax
c01021e7:	89 45 f0             	mov    %eax,-0x10(%ebp)
            unsigned len = ((control_dr >> (shift + 2)) & 3);
c01021ea:	8b 15 b4 7e 12 c0    	mov    0xc0127eb4,%edx
c01021f0:	8b 45 ec             	mov    -0x14(%ebp),%eax
c01021f3:	83 c0 02             	add    $0x2,%eax
c01021f6:	89 d3                	mov    %edx,%ebx
c01021f8:	89 c1                	mov    %eax,%ecx
c01021fa:	d3 eb                	shr    %cl,%ebx
c01021fc:	89 d8                	mov    %ebx,%eax
c01021fe:	83 e0 03             	and    $0x3,%eax
c0102201:	89 45 f4             	mov    %eax,-0xc(%ebp)
            cprintf("    %1d   0x%08x %-10s %6s %d\n", regnum, local_dr[regnum],
c0102204:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0102207:	8b 1c 85 b8 7e 12 c0 	mov    -0x3fed8148(,%eax,4),%ebx
c010220e:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0102211:	8b 0c 85 30 70 12 c0 	mov    -0x3fed8fd0(,%eax,4),%ecx
c0102218:	8b 45 f0             	mov    -0x10(%ebp),%eax
c010221b:	8b 14 85 20 70 12 c0 	mov    -0x3fed8fe0(,%eax,4),%edx
c0102222:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0102225:	8b 04 85 a0 7e 12 c0 	mov    -0x3fed8160(,%eax,4),%eax
c010222c:	89 5c 24 14          	mov    %ebx,0x14(%esp)
c0102230:	89 4c 24 10          	mov    %ecx,0x10(%esp)
c0102234:	89 54 24 0c          	mov    %edx,0xc(%esp)
c0102238:	89 44 24 08          	mov    %eax,0x8(%esp)
c010223c:	8b 45 e8             	mov    -0x18(%ebp),%eax
c010223f:	89 44 24 04          	mov    %eax,0x4(%esp)
c0102243:	c7 04 24 ac b2 10 c0 	movl   $0xc010b2ac,(%esp)
c010224a:	e8 7d f3 ff ff       	call   c01015cc <cprintf>
/* debug_list_dr - list and print all debug registrs' value and type */
void
debug_list_dr(void) {
    bool has = 0;
    int regnum;
    for (regnum = 0; regnum < MAX_DR_NUM; regnum ++) {
c010224f:	83 45 e8 01          	addl   $0x1,-0x18(%ebp)
c0102253:	83 7d e8 03          	cmpl   $0x3,-0x18(%ebp)
c0102257:	0f 8e 2e ff ff ff    	jle    c010218b <debug_list_dr+0x1a>
            unsigned len = ((control_dr >> (shift + 2)) & 3);
            cprintf("    %1d   0x%08x %-10s %6s %d\n", regnum, local_dr[regnum],
                    BreakDescription[type], BreakLengthDescription[len], local_dr_counter[regnum]);
        }
    }
    if (!has) {
c010225d:	83 7d e4 00          	cmpl   $0x0,-0x1c(%ebp)
c0102261:	75 0c                	jne    c010226f <debug_list_dr+0xfe>
        cprintf("no breakpoints or watchpoints.\n");
c0102263:	c7 04 24 cc b2 10 c0 	movl   $0xc010b2cc,(%esp)
c010226a:	e8 5d f3 ff ff       	call   c01015cc <cprintf>
    }
}
c010226f:	83 c4 44             	add    $0x44,%esp
c0102272:	5b                   	pop    %ebx
c0102273:	5d                   	pop    %ebp
c0102274:	c3                   	ret    

c0102275 <debug_start>:
 * type 'step' to decide to run a single step, debug_end won't restore all these
 * debug registers, and keep the value of 'is_dr_saved'. When another debug interrupt
 * occurs, it may go into this function again.
 * */
static void
debug_start(struct trapframe *tf) {
c0102275:	55                   	push   %ebp
c0102276:	89 e5                	mov    %esp,%ebp
    if (!is_dr_saved) {
c0102278:	a1 c8 7e 12 c0       	mov    0xc0127ec8,%eax
c010227d:	85 c0                	test   %eax,%eax
c010227f:	75 0f                	jne    c0102290 <debug_start+0x1b>
        is_dr_saved = 1;
c0102281:	c7 05 c8 7e 12 c0 01 	movl   $0x1,0xc0127ec8
c0102288:	00 00 00 
        save_all_dr();
c010228b:	e8 85 fa ff ff       	call   c0101d15 <save_all_dr>
    }
}
c0102290:	5d                   	pop    %ebp
c0102291:	c3                   	ret    

c0102292 <debug_end>:
/* *
 * debug_end - restore all debug registers if necessory. Note that, if kernel
 * needs to run a single step, it should not restore them.
 * */
static void
debug_end(struct trapframe *tf) {
c0102292:	55                   	push   %ebp
c0102293:	89 e5                	mov    %esp,%ebp
    if (!(tf->tf_eflags & FL_TF) && is_dr_saved) {
c0102295:	8b 45 08             	mov    0x8(%ebp),%eax
c0102298:	8b 40 38             	mov    0x38(%eax),%eax
c010229b:	25 00 01 00 00       	and    $0x100,%eax
c01022a0:	85 c0                	test   %eax,%eax
c01022a2:	75 18                	jne    c01022bc <debug_end+0x2a>
c01022a4:	a1 c8 7e 12 c0       	mov    0xc0127ec8,%eax
c01022a9:	85 c0                	test   %eax,%eax
c01022ab:	74 0f                	je     c01022bc <debug_end+0x2a>
        is_dr_saved = 0;
c01022ad:	c7 05 c8 7e 12 c0 00 	movl   $0x0,0xc0127ec8
c01022b4:	00 00 00 
        restore_all_dr();
c01022b7:	e8 19 fc ff ff       	call   c0101ed5 <restore_all_dr>
    }
}
c01022bc:	5d                   	pop    %ebp
c01022bd:	c3                   	ret    

c01022be <debug_monitor>:

/* debug_monitor - goes into the debugger monitor, and type 'continue' to return */
void
debug_monitor(struct trapframe *tf) {
c01022be:	55                   	push   %ebp
c01022bf:	89 e5                	mov    %esp,%ebp
c01022c1:	83 ec 28             	sub    $0x28,%esp
    assert(tf != NULL);
c01022c4:	83 7d 08 00          	cmpl   $0x0,0x8(%ebp)
c01022c8:	75 24                	jne    c01022ee <debug_monitor+0x30>
c01022ca:	c7 44 24 0c ec b2 10 	movl   $0xc010b2ec,0xc(%esp)
c01022d1:	c0 
c01022d2:	c7 44 24 08 f7 b2 10 	movl   $0xc010b2f7,0x8(%esp)
c01022d9:	c0 
c01022da:	c7 44 24 04 c9 01 00 	movl   $0x1c9,0x4(%esp)
c01022e1:	00 
c01022e2:	c7 04 24 0c b3 10 c0 	movl   $0xc010b30c,(%esp)
c01022e9:	e8 c2 07 00 00       	call   c0102ab0 <__panic>
    bool intr_flag;
    local_intr_save(intr_flag);
c01022ee:	e8 7d f3 ff ff       	call   c0101670 <__intr_save>
c01022f3:	89 45 f4             	mov    %eax,-0xc(%ebp)
    {
        debug_start(tf);
c01022f6:	8b 45 08             	mov    0x8(%ebp),%eax
c01022f9:	89 04 24             	mov    %eax,(%esp)
c01022fc:	e8 74 ff ff ff       	call   c0102275 <debug_start>
        cprintf("debug_monitor at:\n");
c0102301:	c7 04 24 20 b3 10 c0 	movl   $0xc010b320,(%esp)
c0102308:	e8 bf f2 ff ff       	call   c01015cc <cprintf>
        print_debuginfo(tf->tf_eip);
c010230d:	8b 45 08             	mov    0x8(%ebp),%eax
c0102310:	8b 40 30             	mov    0x30(%eax),%eax
c0102313:	89 04 24             	mov    %eax,(%esp)
c0102316:	e8 92 f8 ff ff       	call   c0101bad <print_debuginfo>
        monitor(tf);
c010231b:	8b 45 08             	mov    0x8(%ebp),%eax
c010231e:	89 04 24             	mov    %eax,(%esp)
c0102321:	e8 77 01 00 00       	call   c010249d <monitor>
        debug_end(tf);
c0102326:	8b 45 08             	mov    0x8(%ebp),%eax
c0102329:	89 04 24             	mov    %eax,(%esp)
c010232c:	e8 61 ff ff ff       	call   c0102292 <debug_end>
    }
    local_intr_restore(intr_flag);
c0102331:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0102334:	89 04 24             	mov    %eax,(%esp)
c0102337:	e8 5e f3 ff ff       	call   c010169a <__intr_restore>
}
c010233c:	c9                   	leave  
c010233d:	c3                   	ret    
	...

c0102340 <parse>:
#define MAXARGS         16
#define WHITESPACE      " \t\n\r"

/* parse - parse the command buffer into whitespace-separated arguments */
static int
parse(char *buf, char **argv) {
c0102340:	55                   	push   %ebp
c0102341:	89 e5                	mov    %esp,%ebp
c0102343:	83 ec 28             	sub    $0x28,%esp
    int argc = 0;
c0102346:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
    while (1) {
        // find global whitespace
        while (*buf != '\0' && strchr(WHITESPACE, *buf) != NULL) {
c010234d:	eb 0a                	jmp    c0102359 <parse+0x19>
            *buf ++ = '\0';
c010234f:	8b 45 08             	mov    0x8(%ebp),%eax
c0102352:	c6 00 00             	movb   $0x0,(%eax)
c0102355:	83 45 08 01          	addl   $0x1,0x8(%ebp)
static int
parse(char *buf, char **argv) {
    int argc = 0;
    while (1) {
        // find global whitespace
        while (*buf != '\0' && strchr(WHITESPACE, *buf) != NULL) {
c0102359:	8b 45 08             	mov    0x8(%ebp),%eax
c010235c:	0f b6 00             	movzbl (%eax),%eax
c010235f:	84 c0                	test   %al,%al
c0102361:	74 1d                	je     c0102380 <parse+0x40>
c0102363:	8b 45 08             	mov    0x8(%ebp),%eax
c0102366:	0f b6 00             	movzbl (%eax),%eax
c0102369:	0f be c0             	movsbl %al,%eax
c010236c:	89 44 24 04          	mov    %eax,0x4(%esp)
c0102370:	c7 04 24 61 b6 10 c0 	movl   $0xc010b661,(%esp)
c0102377:	e8 0c 87 00 00       	call   c010aa88 <strchr>
c010237c:	85 c0                	test   %eax,%eax
c010237e:	75 cf                	jne    c010234f <parse+0xf>
            *buf ++ = '\0';
        }
        if (*buf == '\0') {
c0102380:	8b 45 08             	mov    0x8(%ebp),%eax
c0102383:	0f b6 00             	movzbl (%eax),%eax
c0102386:	84 c0                	test   %al,%al
c0102388:	75 05                	jne    c010238f <parse+0x4f>
        argv[argc ++] = buf;
        while (*buf != '\0' && strchr(WHITESPACE, *buf) == NULL) {
            buf ++;
        }
    }
    return argc;
c010238a:	8b 45 f4             	mov    -0xc(%ebp),%eax
}
c010238d:	c9                   	leave  
c010238e:	c3                   	ret    
        if (*buf == '\0') {
            break;
        }

        // save and scan past next arg
        if (argc == MAXARGS - 1) {
c010238f:	83 7d f4 0f          	cmpl   $0xf,-0xc(%ebp)
c0102393:	75 14                	jne    c01023a9 <parse+0x69>
            cprintf("Too many arguments (max %d).\n", MAXARGS);
c0102395:	c7 44 24 04 10 00 00 	movl   $0x10,0x4(%esp)
c010239c:	00 
c010239d:	c7 04 24 66 b6 10 c0 	movl   $0xc010b666,(%esp)
c01023a4:	e8 23 f2 ff ff       	call   c01015cc <cprintf>
        }
        argv[argc ++] = buf;
c01023a9:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01023ac:	c1 e0 02             	shl    $0x2,%eax
c01023af:	03 45 0c             	add    0xc(%ebp),%eax
c01023b2:	8b 55 08             	mov    0x8(%ebp),%edx
c01023b5:	89 10                	mov    %edx,(%eax)
c01023b7:	83 45 f4 01          	addl   $0x1,-0xc(%ebp)
        while (*buf != '\0' && strchr(WHITESPACE, *buf) == NULL) {
c01023bb:	eb 04                	jmp    c01023c1 <parse+0x81>
            buf ++;
c01023bd:	83 45 08 01          	addl   $0x1,0x8(%ebp)
        // save and scan past next arg
        if (argc == MAXARGS - 1) {
            cprintf("Too many arguments (max %d).\n", MAXARGS);
        }
        argv[argc ++] = buf;
        while (*buf != '\0' && strchr(WHITESPACE, *buf) == NULL) {
c01023c1:	8b 45 08             	mov    0x8(%ebp),%eax
c01023c4:	0f b6 00             	movzbl (%eax),%eax
c01023c7:	84 c0                	test   %al,%al
c01023c9:	74 1d                	je     c01023e8 <parse+0xa8>
c01023cb:	8b 45 08             	mov    0x8(%ebp),%eax
c01023ce:	0f b6 00             	movzbl (%eax),%eax
c01023d1:	0f be c0             	movsbl %al,%eax
c01023d4:	89 44 24 04          	mov    %eax,0x4(%esp)
c01023d8:	c7 04 24 61 b6 10 c0 	movl   $0xc010b661,(%esp)
c01023df:	e8 a4 86 00 00       	call   c010aa88 <strchr>
c01023e4:	85 c0                	test   %eax,%eax
c01023e6:	74 d5                	je     c01023bd <parse+0x7d>
            buf ++;
        }
    }
c01023e8:	90                   	nop
static int
parse(char *buf, char **argv) {
    int argc = 0;
    while (1) {
        // find global whitespace
        while (*buf != '\0' && strchr(WHITESPACE, *buf) != NULL) {
c01023e9:	e9 6b ff ff ff       	jmp    c0102359 <parse+0x19>

c01023ee <runcmd>:
/* *
 * runcmd - parse the input string, split it into separated arguments
 * and then lookup and invoke some related commands/
 * */
static int
runcmd(char *buf, struct trapframe *tf) {
c01023ee:	55                   	push   %ebp
c01023ef:	89 e5                	mov    %esp,%ebp
c01023f1:	83 ec 68             	sub    $0x68,%esp
    char *argv[MAXARGS];
    int argc = parse(buf, argv);
c01023f4:	8d 45 b0             	lea    -0x50(%ebp),%eax
c01023f7:	89 44 24 04          	mov    %eax,0x4(%esp)
c01023fb:	8b 45 08             	mov    0x8(%ebp),%eax
c01023fe:	89 04 24             	mov    %eax,(%esp)
c0102401:	e8 3a ff ff ff       	call   c0102340 <parse>
c0102406:	89 45 f0             	mov    %eax,-0x10(%ebp)
    if (argc == 0) {
c0102409:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
c010240d:	75 0a                	jne    c0102419 <runcmd+0x2b>
        return 0;
c010240f:	b8 00 00 00 00       	mov    $0x0,%eax
c0102414:	e9 82 00 00 00       	jmp    c010249b <runcmd+0xad>
    }
    int i;
    for (i = 0; i < NCOMMANDS; i ++) {
c0102419:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
c0102420:	eb 59                	jmp    c010247b <runcmd+0x8d>
        if (strcmp(commands[i].name, argv[0]) == 0) {
c0102422:	8b 4d b0             	mov    -0x50(%ebp),%ecx
c0102425:	8b 55 f4             	mov    -0xc(%ebp),%edx
c0102428:	89 d0                	mov    %edx,%eax
c010242a:	01 c0                	add    %eax,%eax
c010242c:	01 d0                	add    %edx,%eax
c010242e:	c1 e0 02             	shl    $0x2,%eax
c0102431:	8b 80 40 70 12 c0    	mov    -0x3fed8fc0(%eax),%eax
c0102437:	89 4c 24 04          	mov    %ecx,0x4(%esp)
c010243b:	89 04 24             	mov    %eax,(%esp)
c010243e:	e8 a4 85 00 00       	call   c010a9e7 <strcmp>
c0102443:	85 c0                	test   %eax,%eax
c0102445:	75 30                	jne    c0102477 <runcmd+0x89>
            return commands[i].func(argc - 1, argv + 1, tf);
c0102447:	8b 55 f4             	mov    -0xc(%ebp),%edx
c010244a:	89 d0                	mov    %edx,%eax
c010244c:	01 c0                	add    %eax,%eax
c010244e:	01 d0                	add    %edx,%eax
c0102450:	c1 e0 02             	shl    $0x2,%eax
c0102453:	8b 90 48 70 12 c0    	mov    -0x3fed8fb8(%eax),%edx
c0102459:	8b 45 f0             	mov    -0x10(%ebp),%eax
c010245c:	8d 48 ff             	lea    -0x1(%eax),%ecx
c010245f:	8b 45 0c             	mov    0xc(%ebp),%eax
c0102462:	89 44 24 08          	mov    %eax,0x8(%esp)
c0102466:	8d 45 b0             	lea    -0x50(%ebp),%eax
c0102469:	83 c0 04             	add    $0x4,%eax
c010246c:	89 44 24 04          	mov    %eax,0x4(%esp)
c0102470:	89 0c 24             	mov    %ecx,(%esp)
c0102473:	ff d2                	call   *%edx
c0102475:	eb 24                	jmp    c010249b <runcmd+0xad>
    int argc = parse(buf, argv);
    if (argc == 0) {
        return 0;
    }
    int i;
    for (i = 0; i < NCOMMANDS; i ++) {
c0102477:	83 45 f4 01          	addl   $0x1,-0xc(%ebp)
c010247b:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010247e:	83 f8 08             	cmp    $0x8,%eax
c0102481:	76 9f                	jbe    c0102422 <runcmd+0x34>
        if (strcmp(commands[i].name, argv[0]) == 0) {
            return commands[i].func(argc - 1, argv + 1, tf);
        }
    }
    cprintf("Unknown command '%s'\n", argv[0]);
c0102483:	8b 45 b0             	mov    -0x50(%ebp),%eax
c0102486:	89 44 24 04          	mov    %eax,0x4(%esp)
c010248a:	c7 04 24 84 b6 10 c0 	movl   $0xc010b684,(%esp)
c0102491:	e8 36 f1 ff ff       	call   c01015cc <cprintf>
    return 0;
c0102496:	b8 00 00 00 00       	mov    $0x0,%eax
}
c010249b:	c9                   	leave  
c010249c:	c3                   	ret    

c010249d <monitor>:

/***** Implementations of basic kernel monitor commands *****/

void
monitor(struct trapframe *tf) {
c010249d:	55                   	push   %ebp
c010249e:	89 e5                	mov    %esp,%ebp
c01024a0:	83 ec 28             	sub    $0x28,%esp
    cprintf("Welcome to the kernel debug monitor!!\n");
c01024a3:	c7 04 24 9c b6 10 c0 	movl   $0xc010b69c,(%esp)
c01024aa:	e8 1d f1 ff ff       	call   c01015cc <cprintf>
    cprintf("Type 'help' for a list of commands.\n");
c01024af:	c7 04 24 c4 b6 10 c0 	movl   $0xc010b6c4,(%esp)
c01024b6:	e8 11 f1 ff ff       	call   c01015cc <cprintf>

    if (tf != NULL) {
c01024bb:	83 7d 08 00          	cmpl   $0x0,0x8(%ebp)
c01024bf:	74 11                	je     c01024d2 <monitor+0x35>
        print_trapframe(tf);
c01024c1:	8b 45 08             	mov    0x8(%ebp),%eax
c01024c4:	89 04 24             	mov    %eax,(%esp)
c01024c7:	e8 1b 13 00 00       	call   c01037e7 <print_trapframe>
c01024cc:	eb 04                	jmp    c01024d2 <monitor+0x35>
        if ((buf = readline("K> ")) != NULL) {
            if (runcmd(buf, tf) < 0) {
                break;
            }
        }
    }
c01024ce:	90                   	nop
c01024cf:	eb 01                	jmp    c01024d2 <monitor+0x35>
c01024d1:	90                   	nop
        print_trapframe(tf);
    }

    char *buf;
    while (1) {
        if ((buf = readline("K> ")) != NULL) {
c01024d2:	c7 04 24 e9 b6 10 c0 	movl   $0xc010b6e9,(%esp)
c01024d9:	e8 e2 ef ff ff       	call   c01014c0 <readline>
c01024de:	89 45 f4             	mov    %eax,-0xc(%ebp)
c01024e1:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c01024e5:	74 e7                	je     c01024ce <monitor+0x31>
            if (runcmd(buf, tf) < 0) {
c01024e7:	8b 45 08             	mov    0x8(%ebp),%eax
c01024ea:	89 44 24 04          	mov    %eax,0x4(%esp)
c01024ee:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01024f1:	89 04 24             	mov    %eax,(%esp)
c01024f4:	e8 f5 fe ff ff       	call   c01023ee <runcmd>
c01024f9:	85 c0                	test   %eax,%eax
c01024fb:	79 d4                	jns    c01024d1 <monitor+0x34>
                break;
            }
        }
    }
}
c01024fd:	90                   	nop
c01024fe:	c9                   	leave  
c01024ff:	c3                   	ret    

c0102500 <mon_help>:

/* mon_help - print the information about mon_* functions */
int
mon_help(int argc, char **argv, struct trapframe *tf) {
c0102500:	55                   	push   %ebp
c0102501:	89 e5                	mov    %esp,%ebp
c0102503:	83 ec 28             	sub    $0x28,%esp
    int i;
    for (i = 0; i < NCOMMANDS; i ++) {
c0102506:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
c010250d:	eb 3c                	jmp    c010254b <mon_help+0x4b>
        cprintf("%s - %s\n", commands[i].name, commands[i].desc);
c010250f:	8b 55 f4             	mov    -0xc(%ebp),%edx
c0102512:	89 d0                	mov    %edx,%eax
c0102514:	01 c0                	add    %eax,%eax
c0102516:	01 d0                	add    %edx,%eax
c0102518:	c1 e0 02             	shl    $0x2,%eax
c010251b:	8b 88 44 70 12 c0    	mov    -0x3fed8fbc(%eax),%ecx
c0102521:	8b 55 f4             	mov    -0xc(%ebp),%edx
c0102524:	89 d0                	mov    %edx,%eax
c0102526:	01 c0                	add    %eax,%eax
c0102528:	01 d0                	add    %edx,%eax
c010252a:	c1 e0 02             	shl    $0x2,%eax
c010252d:	8b 80 40 70 12 c0    	mov    -0x3fed8fc0(%eax),%eax
c0102533:	89 4c 24 08          	mov    %ecx,0x8(%esp)
c0102537:	89 44 24 04          	mov    %eax,0x4(%esp)
c010253b:	c7 04 24 ed b6 10 c0 	movl   $0xc010b6ed,(%esp)
c0102542:	e8 85 f0 ff ff       	call   c01015cc <cprintf>

/* mon_help - print the information about mon_* functions */
int
mon_help(int argc, char **argv, struct trapframe *tf) {
    int i;
    for (i = 0; i < NCOMMANDS; i ++) {
c0102547:	83 45 f4 01          	addl   $0x1,-0xc(%ebp)
c010254b:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010254e:	83 f8 08             	cmp    $0x8,%eax
c0102551:	76 bc                	jbe    c010250f <mon_help+0xf>
        cprintf("%s - %s\n", commands[i].name, commands[i].desc);
    }
    return 0;
c0102553:	b8 00 00 00 00       	mov    $0x0,%eax
}
c0102558:	c9                   	leave  
c0102559:	c3                   	ret    

c010255a <mon_kerninfo>:
/* *
 * mon_kerninfo - call print_kerninfo in kern/debug/kdebug.c to
 * print the memory occupancy in kernel.
 * */
int
mon_kerninfo(int argc, char **argv, struct trapframe *tf) {
c010255a:	55                   	push   %ebp
c010255b:	89 e5                	mov    %esp,%ebp
c010255d:	83 ec 08             	sub    $0x8,%esp
    print_kerninfo();
c0102560:	e8 b0 f5 ff ff       	call   c0101b15 <print_kerninfo>
    return 0;
c0102565:	b8 00 00 00 00       	mov    $0x0,%eax
}
c010256a:	c9                   	leave  
c010256b:	c3                   	ret    

c010256c <mon_backtrace>:
/* *
 * mon_backtrace - call print_stackframe in kern/debug/kdebug.c to
 * print a backtrace of the stack.
 * */
int
mon_backtrace(int argc, char **argv, struct trapframe *tf) {
c010256c:	55                   	push   %ebp
c010256d:	89 e5                	mov    %esp,%ebp
c010256f:	83 ec 08             	sub    $0x8,%esp
    print_stackframe();
c0102572:	e8 e5 f6 ff ff       	call   c0101c5c <print_stackframe>
    return 0;
c0102577:	b8 00 00 00 00       	mov    $0x0,%eax
}
c010257c:	c9                   	leave  
c010257d:	c3                   	ret    

c010257e <mon_continue>:

/* mon_continue - continue execution if it isn't kernel panic */
int
mon_continue(int argc, char **argv, struct trapframe *tf) {
c010257e:	55                   	push   %ebp
c010257f:	89 e5                	mov    %esp,%ebp
c0102581:	83 ec 18             	sub    $0x18,%esp
    if (is_kernel_panic()) {
c0102584:	e8 da 05 00 00       	call   c0102b63 <is_kernel_panic>
c0102589:	85 c0                	test   %eax,%eax
c010258b:	74 13                	je     c01025a0 <mon_continue+0x22>
        cprintf("can't continue execution in kernel panic.\n");
c010258d:	c7 04 24 f8 b6 10 c0 	movl   $0xc010b6f8,(%esp)
c0102594:	e8 33 f0 ff ff       	call   c01015cc <cprintf>
        return 0;
c0102599:	b8 00 00 00 00       	mov    $0x0,%eax
c010259e:	eb 1c                	jmp    c01025bc <mon_continue+0x3e>
    }
    if (tf != NULL) {
c01025a0:	83 7d 10 00          	cmpl   $0x0,0x10(%ebp)
c01025a4:	74 11                	je     c01025b7 <mon_continue+0x39>
        tf->tf_eflags &= ~FL_TF;
c01025a6:	8b 45 10             	mov    0x10(%ebp),%eax
c01025a9:	8b 40 38             	mov    0x38(%eax),%eax
c01025ac:	89 c2                	mov    %eax,%edx
c01025ae:	80 e6 fe             	and    $0xfe,%dh
c01025b1:	8b 45 10             	mov    0x10(%ebp),%eax
c01025b4:	89 50 38             	mov    %edx,0x38(%eax)
    }
    return -1;
c01025b7:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
}
c01025bc:	c9                   	leave  
c01025bd:	c3                   	ret    

c01025be <mon_step>:

/* mon_step - run a single step */
int
mon_step(int argc, char **argv, struct trapframe *tf) {
c01025be:	55                   	push   %ebp
c01025bf:	89 e5                	mov    %esp,%ebp
c01025c1:	83 ec 18             	sub    $0x18,%esp
    if (is_kernel_panic()) {
c01025c4:	e8 9a 05 00 00       	call   c0102b63 <is_kernel_panic>
c01025c9:	85 c0                	test   %eax,%eax
c01025cb:	74 13                	je     c01025e0 <mon_step+0x22>
        cprintf("can't continue execution in kernel panic.\n");
c01025cd:	c7 04 24 f8 b6 10 c0 	movl   $0xc010b6f8,(%esp)
c01025d4:	e8 f3 ef ff ff       	call   c01015cc <cprintf>
        return 0;
c01025d9:	b8 00 00 00 00       	mov    $0x0,%eax
c01025de:	eb 2f                	jmp    c010260f <mon_step+0x51>
    }
    if (tf != NULL) {
c01025e0:	83 7d 10 00          	cmpl   $0x0,0x10(%ebp)
c01025e4:	74 18                	je     c01025fe <mon_step+0x40>
        tf->tf_eflags |= FL_TF;
c01025e6:	8b 45 10             	mov    0x10(%ebp),%eax
c01025e9:	8b 40 38             	mov    0x38(%eax),%eax
c01025ec:	89 c2                	mov    %eax,%edx
c01025ee:	80 ce 01             	or     $0x1,%dh
c01025f1:	8b 45 10             	mov    0x10(%ebp),%eax
c01025f4:	89 50 38             	mov    %edx,0x38(%eax)
        return -1;
c01025f7:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
c01025fc:	eb 11                	jmp    c010260f <mon_step+0x51>
    }
    cprintf("trapframe is NULL, can't run step.\n");
c01025fe:	c7 04 24 24 b7 10 c0 	movl   $0xc010b724,(%esp)
c0102605:	e8 c2 ef ff ff       	call   c01015cc <cprintf>
    return 0;
c010260a:	b8 00 00 00 00       	mov    $0x0,%eax
}
c010260f:	c9                   	leave  
c0102610:	c3                   	ret    

c0102611 <mon_breakpoint>:

/* mon_breakpoint - set a breakpoint */
int
mon_breakpoint(int argc, char **argv, struct trapframe *tf) {
c0102611:	55                   	push   %ebp
c0102612:	89 e5                	mov    %esp,%ebp
c0102614:	83 ec 38             	sub    $0x38,%esp
    if (argc != 2) {
c0102617:	83 7d 08 02          	cmpl   $0x2,0x8(%ebp)
c010261b:	74 16                	je     c0102633 <mon_breakpoint+0x22>
        cprintf("needs 2 parameter(s).\n");
c010261d:	c7 04 24 48 b7 10 c0 	movl   $0xc010b748,(%esp)
c0102624:	e8 a3 ef ff ff       	call   c01015cc <cprintf>
        return 0;
c0102629:	b8 00 00 00 00       	mov    $0x0,%eax
c010262e:	e9 68 01 00 00       	jmp    c010279b <mon_breakpoint+0x18a>
    }
    uintptr_t addr;
    unsigned regnum = MAX_DR_NUM, type = 0, len = 3;
c0102633:	c7 45 e4 04 00 00 00 	movl   $0x4,-0x1c(%ebp)
c010263a:	c7 45 e8 00 00 00 00 	movl   $0x0,-0x18(%ebp)
c0102641:	c7 45 ec 03 00 00 00 	movl   $0x3,-0x14(%ebp)
    int i;
    for (i = 0; i < argc; i ++) {
c0102648:	c7 45 f0 00 00 00 00 	movl   $0x0,-0x10(%ebp)
c010264f:	e9 b6 00 00 00       	jmp    c010270a <mon_breakpoint+0xf9>
        if (argv[i][0] == '-') {
c0102654:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0102657:	c1 e0 02             	shl    $0x2,%eax
c010265a:	03 45 0c             	add    0xc(%ebp),%eax
c010265d:	8b 00                	mov    (%eax),%eax
c010265f:	0f b6 00             	movzbl (%eax),%eax
c0102662:	3c 2d                	cmp    $0x2d,%al
c0102664:	75 71                	jne    c01026d7 <mon_breakpoint+0xc6>
            if (argv[i][1] != 'r' || strlen(argv[i]) != 3) {
c0102666:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0102669:	c1 e0 02             	shl    $0x2,%eax
c010266c:	03 45 0c             	add    0xc(%ebp),%eax
c010266f:	8b 00                	mov    (%eax),%eax
c0102671:	83 c0 01             	add    $0x1,%eax
c0102674:	0f b6 00             	movzbl (%eax),%eax
c0102677:	3c 72                	cmp    $0x72,%al
c0102679:	0f 85 f5 00 00 00    	jne    c0102774 <mon_breakpoint+0x163>
c010267f:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0102682:	c1 e0 02             	shl    $0x2,%eax
c0102685:	03 45 0c             	add    0xc(%ebp),%eax
c0102688:	8b 00                	mov    (%eax),%eax
c010268a:	89 04 24             	mov    %eax,(%esp)
c010268d:	e8 7e 82 00 00       	call   c010a910 <strlen>
c0102692:	83 f8 03             	cmp    $0x3,%eax
c0102695:	0f 85 d9 00 00 00    	jne    c0102774 <mon_breakpoint+0x163>
                goto bad_argv;
            }
            else {
                switch (argv[i][2]) {
c010269b:	8b 45 f0             	mov    -0x10(%ebp),%eax
c010269e:	c1 e0 02             	shl    $0x2,%eax
c01026a1:	03 45 0c             	add    0xc(%ebp),%eax
c01026a4:	8b 00                	mov    (%eax),%eax
c01026a6:	83 c0 02             	add    $0x2,%eax
c01026a9:	0f b6 00             	movzbl (%eax),%eax
c01026ac:	0f be c0             	movsbl %al,%eax
c01026af:	83 e8 30             	sub    $0x30,%eax
c01026b2:	83 f8 03             	cmp    $0x3,%eax
c01026b5:	0f 87 b5 00 00 00    	ja     c0102770 <mon_breakpoint+0x15f>
                case '0' ... '3': regnum = argv[i][2] - '0'; break;
c01026bb:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01026be:	c1 e0 02             	shl    $0x2,%eax
c01026c1:	03 45 0c             	add    0xc(%ebp),%eax
c01026c4:	8b 00                	mov    (%eax),%eax
c01026c6:	83 c0 02             	add    $0x2,%eax
c01026c9:	0f b6 00             	movzbl (%eax),%eax
c01026cc:	0f be c0             	movsbl %al,%eax
c01026cf:	83 e8 30             	sub    $0x30,%eax
c01026d2:	89 45 e4             	mov    %eax,-0x1c(%ebp)
c01026d5:	eb 2f                	jmp    c0102706 <mon_breakpoint+0xf5>
                }
            }
        }
        else {
            char *endptr;
            addr = strtol(argv[i], &endptr, 16);
c01026d7:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01026da:	c1 e0 02             	shl    $0x2,%eax
c01026dd:	03 45 0c             	add    0xc(%ebp),%eax
c01026e0:	8b 00                	mov    (%eax),%eax
c01026e2:	c7 44 24 08 10 00 00 	movl   $0x10,0x8(%esp)
c01026e9:	00 
c01026ea:	8d 55 dc             	lea    -0x24(%ebp),%edx
c01026ed:	89 54 24 04          	mov    %edx,0x4(%esp)
c01026f1:	89 04 24             	mov    %eax,(%esp)
c01026f4:	e8 f1 83 00 00       	call   c010aaea <strtol>
c01026f9:	89 45 e0             	mov    %eax,-0x20(%ebp)
            if (*endptr != '\0') {
c01026fc:	8b 45 dc             	mov    -0x24(%ebp),%eax
c01026ff:	0f b6 00             	movzbl (%eax),%eax
c0102702:	84 c0                	test   %al,%al
c0102704:	75 6d                	jne    c0102773 <mon_breakpoint+0x162>
        return 0;
    }
    uintptr_t addr;
    unsigned regnum = MAX_DR_NUM, type = 0, len = 3;
    int i;
    for (i = 0; i < argc; i ++) {
c0102706:	83 45 f0 01          	addl   $0x1,-0x10(%ebp)
c010270a:	8b 45 f0             	mov    -0x10(%ebp),%eax
c010270d:	3b 45 08             	cmp    0x8(%ebp),%eax
c0102710:	0f 8c 3e ff ff ff    	jl     c0102654 <mon_breakpoint+0x43>
            if (*endptr != '\0') {
                goto bad_argv;
            }
        }
    }
    int ret = debug_enable_dr(regnum, addr, type, len);
c0102716:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0102719:	89 44 24 0c          	mov    %eax,0xc(%esp)
c010271d:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0102720:	89 44 24 08          	mov    %eax,0x8(%esp)
c0102724:	8b 45 e0             	mov    -0x20(%ebp),%eax
c0102727:	89 44 24 04          	mov    %eax,0x4(%esp)
c010272b:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c010272e:	89 04 24             	mov    %eax,(%esp)
c0102731:	e8 b0 f8 ff ff       	call   c0101fe6 <debug_enable_dr>
c0102736:	89 45 f4             	mov    %eax,-0xc(%ebp)
    cprintf("set breakpoint [%d] at 0x%08x: %s.\n", regnum, addr,
c0102739:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c010273d:	75 07                	jne    c0102746 <mon_breakpoint+0x135>
c010273f:	b8 5f b7 10 c0       	mov    $0xc010b75f,%eax
c0102744:	eb 05                	jmp    c010274b <mon_breakpoint+0x13a>
c0102746:	b8 69 b7 10 c0       	mov    $0xc010b769,%eax
c010274b:	89 44 24 0c          	mov    %eax,0xc(%esp)
c010274f:	8b 45 e0             	mov    -0x20(%ebp),%eax
c0102752:	89 44 24 08          	mov    %eax,0x8(%esp)
c0102756:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0102759:	89 44 24 04          	mov    %eax,0x4(%esp)
c010275d:	c7 04 24 70 b7 10 c0 	movl   $0xc010b770,(%esp)
c0102764:	e8 63 ee ff ff       	call   c01015cc <cprintf>
            (ret == 0) ? "successed" : "failed");
    return 0;
c0102769:	b8 00 00 00 00       	mov    $0x0,%eax
c010276e:	eb 2b                	jmp    c010279b <mon_breakpoint+0x18a>
                goto bad_argv;
            }
            else {
                switch (argv[i][2]) {
                case '0' ... '3': regnum = argv[i][2] - '0'; break;
                default: goto bad_argv;
c0102770:	90                   	nop
c0102771:	eb 01                	jmp    c0102774 <mon_breakpoint+0x163>
        }
        else {
            char *endptr;
            addr = strtol(argv[i], &endptr, 16);
            if (*endptr != '\0') {
                goto bad_argv;
c0102773:	90                   	nop
    cprintf("set breakpoint [%d] at 0x%08x: %s.\n", regnum, addr,
            (ret == 0) ? "successed" : "failed");
    return 0;

bad_argv:
    cprintf("unknow parameter(s): [%d] %s\n", i, argv[i]);
c0102774:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0102777:	c1 e0 02             	shl    $0x2,%eax
c010277a:	03 45 0c             	add    0xc(%ebp),%eax
c010277d:	8b 00                	mov    (%eax),%eax
c010277f:	89 44 24 08          	mov    %eax,0x8(%esp)
c0102783:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0102786:	89 44 24 04          	mov    %eax,0x4(%esp)
c010278a:	c7 04 24 94 b7 10 c0 	movl   $0xc010b794,(%esp)
c0102791:	e8 36 ee ff ff       	call   c01015cc <cprintf>
    return 0;
c0102796:	b8 00 00 00 00       	mov    $0x0,%eax
}
c010279b:	c9                   	leave  
c010279c:	c3                   	ret    

c010279d <mon_watchpoint>:

/* mon_watchpoint - set a watchpoint */
int
mon_watchpoint(int argc, char **argv, struct trapframe *tf) {
c010279d:	55                   	push   %ebp
c010279e:	89 e5                	mov    %esp,%ebp
c01027a0:	83 ec 38             	sub    $0x38,%esp
    if (argc < 2) {
c01027a3:	83 7d 08 01          	cmpl   $0x1,0x8(%ebp)
c01027a7:	7f 16                	jg     c01027bf <mon_watchpoint+0x22>
        cprintf("needs at least 2 parameter(s).\n");
c01027a9:	c7 04 24 b4 b7 10 c0 	movl   $0xc010b7b4,(%esp)
c01027b0:	e8 17 ee ff ff       	call   c01015cc <cprintf>
        return 0;
c01027b5:	b8 00 00 00 00       	mov    $0x0,%eax
c01027ba:	e9 16 02 00 00       	jmp    c01029d5 <mon_watchpoint+0x238>
    }
    uintptr_t addr;
    unsigned regnum = MAX_DR_NUM, type = 1, len = 3;
c01027bf:	c7 45 e0 04 00 00 00 	movl   $0x4,-0x20(%ebp)
c01027c6:	c7 45 e4 01 00 00 00 	movl   $0x1,-0x1c(%ebp)
c01027cd:	c7 45 e8 03 00 00 00 	movl   $0x3,-0x18(%ebp)
    int i;
    for (i = 0; i < argc; i ++) {
c01027d4:	c7 45 ec 00 00 00 00 	movl   $0x0,-0x14(%ebp)
c01027db:	e9 5e 01 00 00       	jmp    c010293e <mon_watchpoint+0x1a1>
        if (argv[i][0] == '-') {
c01027e0:	8b 45 ec             	mov    -0x14(%ebp),%eax
c01027e3:	c1 e0 02             	shl    $0x2,%eax
c01027e6:	03 45 0c             	add    0xc(%ebp),%eax
c01027e9:	8b 00                	mov    (%eax),%eax
c01027eb:	0f b6 00             	movzbl (%eax),%eax
c01027ee:	3c 2d                	cmp    $0x2d,%al
c01027f0:	0f 85 15 01 00 00    	jne    c010290b <mon_watchpoint+0x16e>
            char c = argv[i][1];
c01027f6:	8b 45 ec             	mov    -0x14(%ebp),%eax
c01027f9:	c1 e0 02             	shl    $0x2,%eax
c01027fc:	03 45 0c             	add    0xc(%ebp),%eax
c01027ff:	8b 00                	mov    (%eax),%eax
c0102801:	83 c0 01             	add    $0x1,%eax
c0102804:	0f b6 00             	movzbl (%eax),%eax
c0102807:	88 45 f7             	mov    %al,-0x9(%ebp)
            if ((c != 'r' && c != 't' && c != 'l') || strlen(argv[i]) != 3) {
c010280a:	80 7d f7 72          	cmpb   $0x72,-0x9(%ebp)
c010280e:	74 10                	je     c0102820 <mon_watchpoint+0x83>
c0102810:	80 7d f7 74          	cmpb   $0x74,-0x9(%ebp)
c0102814:	74 0a                	je     c0102820 <mon_watchpoint+0x83>
c0102816:	80 7d f7 6c          	cmpb   $0x6c,-0x9(%ebp)
c010281a:	0f 85 8e 01 00 00    	jne    c01029ae <mon_watchpoint+0x211>
c0102820:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0102823:	c1 e0 02             	shl    $0x2,%eax
c0102826:	03 45 0c             	add    0xc(%ebp),%eax
c0102829:	8b 00                	mov    (%eax),%eax
c010282b:	89 04 24             	mov    %eax,(%esp)
c010282e:	e8 dd 80 00 00       	call   c010a910 <strlen>
c0102833:	83 f8 03             	cmp    $0x3,%eax
c0102836:	0f 85 72 01 00 00    	jne    c01029ae <mon_watchpoint+0x211>
                goto bad_argv;
            }
            switch (c) {
c010283c:	0f be 45 f7          	movsbl -0x9(%ebp),%eax
c0102840:	83 f8 72             	cmp    $0x72,%eax
c0102843:	74 0f                	je     c0102854 <mon_watchpoint+0xb7>
c0102845:	83 f8 74             	cmp    $0x74,%eax
c0102848:	74 49                	je     c0102893 <mon_watchpoint+0xf6>
c010284a:	83 f8 6c             	cmp    $0x6c,%eax
c010284d:	74 79                	je     c01028c8 <mon_watchpoint+0x12b>
            case 'l':
                switch (argv[i][2]) {
                case '1': len = 0; break;
                case '2': len = 1; break;
                case '4': len = 3; break;
                default: goto bad_argv;
c010284f:	e9 e6 00 00 00       	jmp    c010293a <mon_watchpoint+0x19d>
            if ((c != 'r' && c != 't' && c != 'l') || strlen(argv[i]) != 3) {
                goto bad_argv;
            }
            switch (c) {
            case 'r':
                switch (argv[i][2]) {
c0102854:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0102857:	c1 e0 02             	shl    $0x2,%eax
c010285a:	03 45 0c             	add    0xc(%ebp),%eax
c010285d:	8b 00                	mov    (%eax),%eax
c010285f:	83 c0 02             	add    $0x2,%eax
c0102862:	0f b6 00             	movzbl (%eax),%eax
c0102865:	0f be c0             	movsbl %al,%eax
c0102868:	83 e8 30             	sub    $0x30,%eax
c010286b:	83 f8 03             	cmp    $0x3,%eax
c010286e:	0f 87 30 01 00 00    	ja     c01029a4 <mon_watchpoint+0x207>
                case '0' ... '3': regnum = argv[i][2] - '0'; break;
c0102874:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0102877:	c1 e0 02             	shl    $0x2,%eax
c010287a:	03 45 0c             	add    0xc(%ebp),%eax
c010287d:	8b 00                	mov    (%eax),%eax
c010287f:	83 c0 02             	add    $0x2,%eax
c0102882:	0f b6 00             	movzbl (%eax),%eax
c0102885:	0f be c0             	movsbl %al,%eax
c0102888:	83 e8 30             	sub    $0x30,%eax
c010288b:	89 45 e0             	mov    %eax,-0x20(%ebp)
                default: goto bad_argv;
                }
                break;
c010288e:	e9 a7 00 00 00       	jmp    c010293a <mon_watchpoint+0x19d>
            case 't':
                switch (argv[i][2]) {
c0102893:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0102896:	c1 e0 02             	shl    $0x2,%eax
c0102899:	03 45 0c             	add    0xc(%ebp),%eax
c010289c:	8b 00                	mov    (%eax),%eax
c010289e:	83 c0 02             	add    $0x2,%eax
c01028a1:	0f b6 00             	movzbl (%eax),%eax
c01028a4:	0f be c0             	movsbl %al,%eax
c01028a7:	83 f8 61             	cmp    $0x61,%eax
c01028aa:	74 12                	je     c01028be <mon_watchpoint+0x121>
c01028ac:	83 f8 77             	cmp    $0x77,%eax
c01028af:	0f 85 f2 00 00 00    	jne    c01029a7 <mon_watchpoint+0x20a>
                case 'w': type = 1; break;
c01028b5:	c7 45 e4 01 00 00 00 	movl   $0x1,-0x1c(%ebp)
c01028bc:	eb 08                	jmp    c01028c6 <mon_watchpoint+0x129>
                case 'a': type = 3; break;
c01028be:	c7 45 e4 03 00 00 00 	movl   $0x3,-0x1c(%ebp)
c01028c5:	90                   	nop
                default: goto bad_argv;
                }
                break;
c01028c6:	eb 72                	jmp    c010293a <mon_watchpoint+0x19d>
            case 'l':
                switch (argv[i][2]) {
c01028c8:	8b 45 ec             	mov    -0x14(%ebp),%eax
c01028cb:	c1 e0 02             	shl    $0x2,%eax
c01028ce:	03 45 0c             	add    0xc(%ebp),%eax
c01028d1:	8b 00                	mov    (%eax),%eax
c01028d3:	83 c0 02             	add    $0x2,%eax
c01028d6:	0f b6 00             	movzbl (%eax),%eax
c01028d9:	0f be c0             	movsbl %al,%eax
c01028dc:	83 f8 32             	cmp    $0x32,%eax
c01028df:	74 17                	je     c01028f8 <mon_watchpoint+0x15b>
c01028e1:	83 f8 34             	cmp    $0x34,%eax
c01028e4:	74 1b                	je     c0102901 <mon_watchpoint+0x164>
c01028e6:	83 f8 31             	cmp    $0x31,%eax
c01028e9:	0f 85 bb 00 00 00    	jne    c01029aa <mon_watchpoint+0x20d>
                case '1': len = 0; break;
c01028ef:	c7 45 e8 00 00 00 00 	movl   $0x0,-0x18(%ebp)
c01028f6:	eb 42                	jmp    c010293a <mon_watchpoint+0x19d>
                case '2': len = 1; break;
c01028f8:	c7 45 e8 01 00 00 00 	movl   $0x1,-0x18(%ebp)
c01028ff:	eb 39                	jmp    c010293a <mon_watchpoint+0x19d>
                case '4': len = 3; break;
c0102901:	c7 45 e8 03 00 00 00 	movl   $0x3,-0x18(%ebp)
c0102908:	90                   	nop
c0102909:	eb 2f                	jmp    c010293a <mon_watchpoint+0x19d>
                break;
            }
        }
        else {
            char *endptr;
            addr = strtol(argv[i], &endptr, 16);
c010290b:	8b 45 ec             	mov    -0x14(%ebp),%eax
c010290e:	c1 e0 02             	shl    $0x2,%eax
c0102911:	03 45 0c             	add    0xc(%ebp),%eax
c0102914:	8b 00                	mov    (%eax),%eax
c0102916:	c7 44 24 08 10 00 00 	movl   $0x10,0x8(%esp)
c010291d:	00 
c010291e:	8d 55 d8             	lea    -0x28(%ebp),%edx
c0102921:	89 54 24 04          	mov    %edx,0x4(%esp)
c0102925:	89 04 24             	mov    %eax,(%esp)
c0102928:	e8 bd 81 00 00       	call   c010aaea <strtol>
c010292d:	89 45 dc             	mov    %eax,-0x24(%ebp)
            if (*endptr != '\0') {
c0102930:	8b 45 d8             	mov    -0x28(%ebp),%eax
c0102933:	0f b6 00             	movzbl (%eax),%eax
c0102936:	84 c0                	test   %al,%al
c0102938:	75 73                	jne    c01029ad <mon_watchpoint+0x210>
        return 0;
    }
    uintptr_t addr;
    unsigned regnum = MAX_DR_NUM, type = 1, len = 3;
    int i;
    for (i = 0; i < argc; i ++) {
c010293a:	83 45 ec 01          	addl   $0x1,-0x14(%ebp)
c010293e:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0102941:	3b 45 08             	cmp    0x8(%ebp),%eax
c0102944:	0f 8c 96 fe ff ff    	jl     c01027e0 <mon_watchpoint+0x43>
            if (*endptr != '\0') {
                goto bad_argv;
            }
        }
    }
    int ret = debug_enable_dr(regnum, addr, type, len);
c010294a:	8b 45 e8             	mov    -0x18(%ebp),%eax
c010294d:	89 44 24 0c          	mov    %eax,0xc(%esp)
c0102951:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0102954:	89 44 24 08          	mov    %eax,0x8(%esp)
c0102958:	8b 45 dc             	mov    -0x24(%ebp),%eax
c010295b:	89 44 24 04          	mov    %eax,0x4(%esp)
c010295f:	8b 45 e0             	mov    -0x20(%ebp),%eax
c0102962:	89 04 24             	mov    %eax,(%esp)
c0102965:	e8 7c f6 ff ff       	call   c0101fe6 <debug_enable_dr>
c010296a:	89 45 f0             	mov    %eax,-0x10(%ebp)
    cprintf("set watchpoint [%d] at 0x%08x: %s.\n", regnum, addr,
c010296d:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
c0102971:	75 07                	jne    c010297a <mon_watchpoint+0x1dd>
c0102973:	b8 5f b7 10 c0       	mov    $0xc010b75f,%eax
c0102978:	eb 05                	jmp    c010297f <mon_watchpoint+0x1e2>
c010297a:	b8 69 b7 10 c0       	mov    $0xc010b769,%eax
c010297f:	89 44 24 0c          	mov    %eax,0xc(%esp)
c0102983:	8b 45 dc             	mov    -0x24(%ebp),%eax
c0102986:	89 44 24 08          	mov    %eax,0x8(%esp)
c010298a:	8b 45 e0             	mov    -0x20(%ebp),%eax
c010298d:	89 44 24 04          	mov    %eax,0x4(%esp)
c0102991:	c7 04 24 d4 b7 10 c0 	movl   $0xc010b7d4,(%esp)
c0102998:	e8 2f ec ff ff       	call   c01015cc <cprintf>
            (ret == 0) ? "successed" : "failed");
    return 0;
c010299d:	b8 00 00 00 00       	mov    $0x0,%eax
c01029a2:	eb 31                	jmp    c01029d5 <mon_watchpoint+0x238>
            }
            switch (c) {
            case 'r':
                switch (argv[i][2]) {
                case '0' ... '3': regnum = argv[i][2] - '0'; break;
                default: goto bad_argv;
c01029a4:	90                   	nop
c01029a5:	eb 07                	jmp    c01029ae <mon_watchpoint+0x211>
                break;
            case 't':
                switch (argv[i][2]) {
                case 'w': type = 1; break;
                case 'a': type = 3; break;
                default: goto bad_argv;
c01029a7:	90                   	nop
c01029a8:	eb 04                	jmp    c01029ae <mon_watchpoint+0x211>
            case 'l':
                switch (argv[i][2]) {
                case '1': len = 0; break;
                case '2': len = 1; break;
                case '4': len = 3; break;
                default: goto bad_argv;
c01029aa:	90                   	nop
c01029ab:	eb 01                	jmp    c01029ae <mon_watchpoint+0x211>
        }
        else {
            char *endptr;
            addr = strtol(argv[i], &endptr, 16);
            if (*endptr != '\0') {
                goto bad_argv;
c01029ad:	90                   	nop
    cprintf("set watchpoint [%d] at 0x%08x: %s.\n", regnum, addr,
            (ret == 0) ? "successed" : "failed");
    return 0;

bad_argv:
    cprintf("unknow parameter(s): [%d] %s\n", i, argv[i]);
c01029ae:	8b 45 ec             	mov    -0x14(%ebp),%eax
c01029b1:	c1 e0 02             	shl    $0x2,%eax
c01029b4:	03 45 0c             	add    0xc(%ebp),%eax
c01029b7:	8b 00                	mov    (%eax),%eax
c01029b9:	89 44 24 08          	mov    %eax,0x8(%esp)
c01029bd:	8b 45 ec             	mov    -0x14(%ebp),%eax
c01029c0:	89 44 24 04          	mov    %eax,0x4(%esp)
c01029c4:	c7 04 24 94 b7 10 c0 	movl   $0xc010b794,(%esp)
c01029cb:	e8 fc eb ff ff       	call   c01015cc <cprintf>
    return 0;
c01029d0:	b8 00 00 00 00       	mov    $0x0,%eax
}
c01029d5:	c9                   	leave  
c01029d6:	c3                   	ret    

c01029d7 <mon_delete_dr>:

/* mon_delete_dr - delete a breakpoint or watchpoint */
int
mon_delete_dr(int argc, char **argv, struct trapframe *tf) {
c01029d7:	55                   	push   %ebp
c01029d8:	89 e5                	mov    %esp,%ebp
c01029da:	83 ec 28             	sub    $0x28,%esp
    if (argc != 1) {
c01029dd:	83 7d 08 01          	cmpl   $0x1,0x8(%ebp)
c01029e1:	74 16                	je     c01029f9 <mon_delete_dr+0x22>
        cprintf("needs 1 parameter(s).\n");
c01029e3:	c7 04 24 f8 b7 10 c0 	movl   $0xc010b7f8,(%esp)
c01029ea:	e8 dd eb ff ff       	call   c01015cc <cprintf>
        return 0;
c01029ef:	b8 00 00 00 00       	mov    $0x0,%eax
c01029f4:	e9 a1 00 00 00       	jmp    c0102a9a <mon_delete_dr+0xc3>
    }
    unsigned regnum = MAX_DR_NUM;
c01029f9:	c7 45 f0 04 00 00 00 	movl   $0x4,-0x10(%ebp)
    if (strlen(argv[0]) != 1) {
c0102a00:	8b 45 0c             	mov    0xc(%ebp),%eax
c0102a03:	8b 00                	mov    (%eax),%eax
c0102a05:	89 04 24             	mov    %eax,(%esp)
c0102a08:	e8 03 7f 00 00       	call   c010a910 <strlen>
c0102a0d:	83 f8 01             	cmp    $0x1,%eax
c0102a10:	75 62                	jne    c0102a74 <mon_delete_dr+0x9d>
        goto bad_argv;
    }
    else {
        switch (argv[0][0]) {
c0102a12:	8b 45 0c             	mov    0xc(%ebp),%eax
c0102a15:	8b 00                	mov    (%eax),%eax
c0102a17:	0f b6 00             	movzbl (%eax),%eax
c0102a1a:	0f be c0             	movsbl %al,%eax
c0102a1d:	83 e8 30             	sub    $0x30,%eax
c0102a20:	83 f8 03             	cmp    $0x3,%eax
c0102a23:	77 52                	ja     c0102a77 <mon_delete_dr+0xa0>
        case '0' ... '3': regnum = argv[0][0] - '0'; break;
c0102a25:	8b 45 0c             	mov    0xc(%ebp),%eax
c0102a28:	8b 00                	mov    (%eax),%eax
c0102a2a:	0f b6 00             	movzbl (%eax),%eax
c0102a2d:	0f be c0             	movsbl %al,%eax
c0102a30:	83 e8 30             	sub    $0x30,%eax
c0102a33:	89 45 f0             	mov    %eax,-0x10(%ebp)
        default: goto bad_argv;
        }
    }
    int ret = debug_disable_dr(regnum);
c0102a36:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0102a39:	89 04 24             	mov    %eax,(%esp)
c0102a3c:	e8 6e f6 ff ff       	call   c01020af <debug_disable_dr>
c0102a41:	89 45 f4             	mov    %eax,-0xc(%ebp)
    cprintf("delete [%d]: %s.\n", regnum,
c0102a44:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c0102a48:	75 07                	jne    c0102a51 <mon_delete_dr+0x7a>
c0102a4a:	b8 5f b7 10 c0       	mov    $0xc010b75f,%eax
c0102a4f:	eb 05                	jmp    c0102a56 <mon_delete_dr+0x7f>
c0102a51:	b8 69 b7 10 c0       	mov    $0xc010b769,%eax
c0102a56:	89 44 24 08          	mov    %eax,0x8(%esp)
c0102a5a:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0102a5d:	89 44 24 04          	mov    %eax,0x4(%esp)
c0102a61:	c7 04 24 0f b8 10 c0 	movl   $0xc010b80f,(%esp)
c0102a68:	e8 5f eb ff ff       	call   c01015cc <cprintf>
            (ret == 0) ? "successed" : "failed");
    return 0;
c0102a6d:	b8 00 00 00 00       	mov    $0x0,%eax
c0102a72:	eb 26                	jmp    c0102a9a <mon_delete_dr+0xc3>
        cprintf("needs 1 parameter(s).\n");
        return 0;
    }
    unsigned regnum = MAX_DR_NUM;
    if (strlen(argv[0]) != 1) {
        goto bad_argv;
c0102a74:	90                   	nop
c0102a75:	eb 01                	jmp    c0102a78 <mon_delete_dr+0xa1>
    }
    else {
        switch (argv[0][0]) {
        case '0' ... '3': regnum = argv[0][0] - '0'; break;
        default: goto bad_argv;
c0102a77:	90                   	nop
    cprintf("delete [%d]: %s.\n", regnum,
            (ret == 0) ? "successed" : "failed");
    return 0;

bad_argv:
    cprintf("unknow parameter(s): [%d] %s\n", 0, argv[0]);
c0102a78:	8b 45 0c             	mov    0xc(%ebp),%eax
c0102a7b:	8b 00                	mov    (%eax),%eax
c0102a7d:	89 44 24 08          	mov    %eax,0x8(%esp)
c0102a81:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
c0102a88:	00 
c0102a89:	c7 04 24 94 b7 10 c0 	movl   $0xc010b794,(%esp)
c0102a90:	e8 37 eb ff ff       	call   c01015cc <cprintf>
    return 0;
c0102a95:	b8 00 00 00 00       	mov    $0x0,%eax
}
c0102a9a:	c9                   	leave  
c0102a9b:	c3                   	ret    

c0102a9c <mon_list_dr>:

/* mon_list_dr - list all debug registers */
int
mon_list_dr(int argc, char **argv, struct trapframe *tf) {
c0102a9c:	55                   	push   %ebp
c0102a9d:	89 e5                	mov    %esp,%ebp
c0102a9f:	83 ec 08             	sub    $0x8,%esp
    debug_list_dr();
c0102aa2:	e8 ca f6 ff ff       	call   c0102171 <debug_list_dr>
    return 0;
c0102aa7:	b8 00 00 00 00       	mov    $0x0,%eax
}
c0102aac:	c9                   	leave  
c0102aad:	c3                   	ret    
	...

c0102ab0 <__panic>:
/* *
 * __panic - __panic is called on unresolvable fatal errors. it prints
 * "panic: 'message'", and then enters the kernel monitor.
 * */
void
__panic(const char *file, int line, const char *fmt, ...) {
c0102ab0:	55                   	push   %ebp
c0102ab1:	89 e5                	mov    %esp,%ebp
c0102ab3:	83 ec 28             	sub    $0x28,%esp
    if (is_panic) {
c0102ab6:	a1 cc 7e 12 c0       	mov    0xc0127ecc,%eax
c0102abb:	85 c0                	test   %eax,%eax
c0102abd:	75 4a                	jne    c0102b09 <__panic+0x59>
        goto panic_dead;
    }
    is_panic = 1;
c0102abf:	c7 05 cc 7e 12 c0 01 	movl   $0x1,0xc0127ecc
c0102ac6:	00 00 00 

    // print the 'message'
    va_list ap;
    va_start(ap, fmt);
c0102ac9:	8d 45 14             	lea    0x14(%ebp),%eax
c0102acc:	89 45 f4             	mov    %eax,-0xc(%ebp)
    cprintf("kernel panic at %s:%d:\n    ", file, line);
c0102acf:	8b 45 0c             	mov    0xc(%ebp),%eax
c0102ad2:	89 44 24 08          	mov    %eax,0x8(%esp)
c0102ad6:	8b 45 08             	mov    0x8(%ebp),%eax
c0102ad9:	89 44 24 04          	mov    %eax,0x4(%esp)
c0102add:	c7 04 24 21 b8 10 c0 	movl   $0xc010b821,(%esp)
c0102ae4:	e8 e3 ea ff ff       	call   c01015cc <cprintf>
    vcprintf(fmt, ap);
c0102ae9:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0102aec:	89 44 24 04          	mov    %eax,0x4(%esp)
c0102af0:	8b 45 10             	mov    0x10(%ebp),%eax
c0102af3:	89 04 24             	mov    %eax,(%esp)
c0102af6:	e8 9d ea ff ff       	call   c0101598 <vcprintf>
    cprintf("\n");
c0102afb:	c7 04 24 3d b8 10 c0 	movl   $0xc010b83d,(%esp)
c0102b02:	e8 c5 ea ff ff       	call   c01015cc <cprintf>
c0102b07:	eb 01                	jmp    c0102b0a <__panic+0x5a>
 * "panic: 'message'", and then enters the kernel monitor.
 * */
void
__panic(const char *file, int line, const char *fmt, ...) {
    if (is_panic) {
        goto panic_dead;
c0102b09:	90                   	nop
    vcprintf(fmt, ap);
    cprintf("\n");
    va_end(ap);

panic_dead:
    intr_disable();
c0102b0a:	e8 93 09 00 00       	call   c01034a2 <intr_disable>
    while (1) {
        monitor(NULL);
c0102b0f:	c7 04 24 00 00 00 00 	movl   $0x0,(%esp)
c0102b16:	e8 82 f9 ff ff       	call   c010249d <monitor>
    }
c0102b1b:	eb f2                	jmp    c0102b0f <__panic+0x5f>

c0102b1d <__warn>:
}

/* __warn - like panic, but don't */
void
__warn(const char *file, int line, const char *fmt, ...) {
c0102b1d:	55                   	push   %ebp
c0102b1e:	89 e5                	mov    %esp,%ebp
c0102b20:	83 ec 28             	sub    $0x28,%esp
    va_list ap;
    va_start(ap, fmt);
c0102b23:	8d 45 14             	lea    0x14(%ebp),%eax
c0102b26:	89 45 f4             	mov    %eax,-0xc(%ebp)
    cprintf("kernel warning at %s:%d:\n    ", file, line);
c0102b29:	8b 45 0c             	mov    0xc(%ebp),%eax
c0102b2c:	89 44 24 08          	mov    %eax,0x8(%esp)
c0102b30:	8b 45 08             	mov    0x8(%ebp),%eax
c0102b33:	89 44 24 04          	mov    %eax,0x4(%esp)
c0102b37:	c7 04 24 3f b8 10 c0 	movl   $0xc010b83f,(%esp)
c0102b3e:	e8 89 ea ff ff       	call   c01015cc <cprintf>
    vcprintf(fmt, ap);
c0102b43:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0102b46:	89 44 24 04          	mov    %eax,0x4(%esp)
c0102b4a:	8b 45 10             	mov    0x10(%ebp),%eax
c0102b4d:	89 04 24             	mov    %eax,(%esp)
c0102b50:	e8 43 ea ff ff       	call   c0101598 <vcprintf>
    cprintf("\n");
c0102b55:	c7 04 24 3d b8 10 c0 	movl   $0xc010b83d,(%esp)
c0102b5c:	e8 6b ea ff ff       	call   c01015cc <cprintf>
    va_end(ap);
}
c0102b61:	c9                   	leave  
c0102b62:	c3                   	ret    

c0102b63 <is_kernel_panic>:

bool
is_kernel_panic(void) {
c0102b63:	55                   	push   %ebp
c0102b64:	89 e5                	mov    %esp,%ebp
    return is_panic;
c0102b66:	a1 cc 7e 12 c0       	mov    0xc0127ecc,%eax
}
c0102b6b:	5d                   	pop    %ebp
c0102b6c:	c3                   	ret    
c0102b6d:	00 00                	add    %al,(%eax)
	...

c0102b70 <clock_init>:
/* *
 * clock_init - initialize 8253 clock to interrupt 100 times per second,
 * and then enable IRQ_TIMER.
 * */
void
clock_init(void) {
c0102b70:	55                   	push   %ebp
c0102b71:	89 e5                	mov    %esp,%ebp
c0102b73:	83 ec 28             	sub    $0x28,%esp
c0102b76:	66 c7 45 ee 43 00    	movw   $0x43,-0x12(%ebp)
c0102b7c:	c6 45 ed 34          	movb   $0x34,-0x13(%ebp)
        : "memory", "cc");
}

static inline void
outb(uint16_t port, uint8_t data) {
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port));
c0102b80:	0f b6 45 ed          	movzbl -0x13(%ebp),%eax
c0102b84:	0f b7 55 ee          	movzwl -0x12(%ebp),%edx
c0102b88:	ee                   	out    %al,(%dx)
c0102b89:	66 c7 45 f2 40 00    	movw   $0x40,-0xe(%ebp)
c0102b8f:	c6 45 f1 9c          	movb   $0x9c,-0xf(%ebp)
c0102b93:	0f b6 45 f1          	movzbl -0xf(%ebp),%eax
c0102b97:	0f b7 55 f2          	movzwl -0xe(%ebp),%edx
c0102b9b:	ee                   	out    %al,(%dx)
c0102b9c:	66 c7 45 f6 40 00    	movw   $0x40,-0xa(%ebp)
c0102ba2:	c6 45 f5 2e          	movb   $0x2e,-0xb(%ebp)
c0102ba6:	0f b6 45 f5          	movzbl -0xb(%ebp),%eax
c0102baa:	0f b7 55 f6          	movzwl -0xa(%ebp),%edx
c0102bae:	ee                   	out    %al,(%dx)
    outb(TIMER_MODE, TIMER_SEL0 | TIMER_RATEGEN | TIMER_16BIT);
    outb(IO_TIMER1, TIMER_DIV(100) % 256);
    outb(IO_TIMER1, TIMER_DIV(100) / 256);

    // initialize time counter 'ticks' to zero
    ticks = 0;
c0102baf:	c7 05 a8 8c 12 c0 00 	movl   $0x0,0xc0128ca8
c0102bb6:	00 00 00 

    cprintf("++ setup timer interrupts\n");
c0102bb9:	c7 04 24 5d b8 10 c0 	movl   $0xc010b85d,(%esp)
c0102bc0:	e8 07 ea ff ff       	call   c01015cc <cprintf>
    pic_enable(IRQ_TIMER);
c0102bc5:	c7 04 24 00 00 00 00 	movl   $0x0,(%esp)
c0102bcc:	e8 2f 09 00 00       	call   c0103500 <pic_enable>
}
c0102bd1:	c9                   	leave  
c0102bd2:	c3                   	ret    
	...

c0102bd4 <__intr_save>:
#include <x86.h>
#include <intr.h>
#include <mmu.h>

static inline bool
__intr_save(void) {
c0102bd4:	55                   	push   %ebp
c0102bd5:	89 e5                	mov    %esp,%ebp
c0102bd7:	83 ec 18             	sub    $0x18,%esp
}

static inline uint32_t
read_eflags(void) {
    uint32_t eflags;
    asm volatile ("pushfl; popl %0" : "=r" (eflags));
c0102bda:	9c                   	pushf  
c0102bdb:	58                   	pop    %eax
c0102bdc:	89 45 f4             	mov    %eax,-0xc(%ebp)
    return eflags;
c0102bdf:	8b 45 f4             	mov    -0xc(%ebp),%eax
    if (read_eflags() & FL_IF) {
c0102be2:	25 00 02 00 00       	and    $0x200,%eax
c0102be7:	85 c0                	test   %eax,%eax
c0102be9:	74 0c                	je     c0102bf7 <__intr_save+0x23>
        intr_disable();
c0102beb:	e8 b2 08 00 00       	call   c01034a2 <intr_disable>
        return 1;
c0102bf0:	b8 01 00 00 00       	mov    $0x1,%eax
c0102bf5:	eb 05                	jmp    c0102bfc <__intr_save+0x28>
    }
    return 0;
c0102bf7:	b8 00 00 00 00       	mov    $0x0,%eax
}
c0102bfc:	c9                   	leave  
c0102bfd:	c3                   	ret    

c0102bfe <__intr_restore>:

static inline void
__intr_restore(bool flag) {
c0102bfe:	55                   	push   %ebp
c0102bff:	89 e5                	mov    %esp,%ebp
c0102c01:	83 ec 08             	sub    $0x8,%esp
    if (flag) {
c0102c04:	83 7d 08 00          	cmpl   $0x0,0x8(%ebp)
c0102c08:	74 05                	je     c0102c0f <__intr_restore+0x11>
        intr_enable();
c0102c0a:	e8 8d 08 00 00       	call   c010349c <intr_enable>
    }
}
c0102c0f:	c9                   	leave  
c0102c10:	c3                   	ret    

c0102c11 <delay>:
#include <memlayout.h>
#include <sync.h>

/* stupid I/O delay routine necessitated by historical PC design flaws */
static void
delay(void) {
c0102c11:	55                   	push   %ebp
c0102c12:	89 e5                	mov    %esp,%ebp
c0102c14:	83 ec 10             	sub    $0x10,%esp
c0102c17:	66 c7 45 f0 84 00    	movw   $0x84,-0x10(%ebp)
static inline void invlpg(void *addr) __attribute__((always_inline));

static inline uint8_t
inb(uint16_t port) {
    uint8_t data;
    asm volatile ("inb %1, %0" : "=a" (data) : "d" (port));
c0102c1d:	0f b7 45 f0          	movzwl -0x10(%ebp),%eax
c0102c21:	89 c2                	mov    %eax,%edx
c0102c23:	ec                   	in     (%dx),%al
c0102c24:	88 45 f3             	mov    %al,-0xd(%ebp)
    return data;
c0102c27:	66 c7 45 f4 84 00    	movw   $0x84,-0xc(%ebp)
static inline void invlpg(void *addr) __attribute__((always_inline));

static inline uint8_t
inb(uint16_t port) {
    uint8_t data;
    asm volatile ("inb %1, %0" : "=a" (data) : "d" (port));
c0102c2d:	0f b7 45 f4          	movzwl -0xc(%ebp),%eax
c0102c31:	89 c2                	mov    %eax,%edx
c0102c33:	ec                   	in     (%dx),%al
c0102c34:	88 45 f7             	mov    %al,-0x9(%ebp)
    return data;
c0102c37:	66 c7 45 f8 84 00    	movw   $0x84,-0x8(%ebp)
static inline void invlpg(void *addr) __attribute__((always_inline));

static inline uint8_t
inb(uint16_t port) {
    uint8_t data;
    asm volatile ("inb %1, %0" : "=a" (data) : "d" (port));
c0102c3d:	0f b7 45 f8          	movzwl -0x8(%ebp),%eax
c0102c41:	89 c2                	mov    %eax,%edx
c0102c43:	ec                   	in     (%dx),%al
c0102c44:	88 45 fb             	mov    %al,-0x5(%ebp)
    return data;
c0102c47:	66 c7 45 fc 84 00    	movw   $0x84,-0x4(%ebp)
static inline void invlpg(void *addr) __attribute__((always_inline));

static inline uint8_t
inb(uint16_t port) {
    uint8_t data;
    asm volatile ("inb %1, %0" : "=a" (data) : "d" (port));
c0102c4d:	0f b7 45 fc          	movzwl -0x4(%ebp),%eax
c0102c51:	89 c2                	mov    %eax,%edx
c0102c53:	ec                   	in     (%dx),%al
c0102c54:	88 45 ff             	mov    %al,-0x1(%ebp)
    inb(0x84);
    inb(0x84);
    inb(0x84);
    inb(0x84);
}
c0102c57:	c9                   	leave  
c0102c58:	c3                   	ret    

c0102c59 <cga_init>:
static uint16_t addr_6845;

/* TEXT-mode CGA/VGA display output */

static void
cga_init(void) {
c0102c59:	55                   	push   %ebp
c0102c5a:	89 e5                	mov    %esp,%ebp
c0102c5c:	83 ec 20             	sub    $0x20,%esp
    volatile uint16_t *cp = (uint16_t *)(CGA_BUF + KERNBASE);
c0102c5f:	c7 45 e4 00 80 0b c0 	movl   $0xc00b8000,-0x1c(%ebp)
    uint16_t was = *cp;
c0102c66:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0102c69:	0f b7 00             	movzwl (%eax),%eax
c0102c6c:	66 89 45 ea          	mov    %ax,-0x16(%ebp)
    *cp = (uint16_t) 0xA55A;
c0102c70:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0102c73:	66 c7 00 5a a5       	movw   $0xa55a,(%eax)
    if (*cp != 0xA55A) {
c0102c78:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0102c7b:	0f b7 00             	movzwl (%eax),%eax
c0102c7e:	66 3d 5a a5          	cmp    $0xa55a,%ax
c0102c82:	74 12                	je     c0102c96 <cga_init+0x3d>
        cp = (uint16_t*)(MONO_BUF + KERNBASE);
c0102c84:	c7 45 e4 00 00 0b c0 	movl   $0xc00b0000,-0x1c(%ebp)
        addr_6845 = MONO_BASE;
c0102c8b:	66 c7 05 e6 7e 12 c0 	movw   $0x3b4,0xc0127ee6
c0102c92:	b4 03 
c0102c94:	eb 13                	jmp    c0102ca9 <cga_init+0x50>
    } else {
        *cp = was;
c0102c96:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0102c99:	0f b7 55 ea          	movzwl -0x16(%ebp),%edx
c0102c9d:	66 89 10             	mov    %dx,(%eax)
        addr_6845 = CGA_BASE;
c0102ca0:	66 c7 05 e6 7e 12 c0 	movw   $0x3d4,0xc0127ee6
c0102ca7:	d4 03 
    }

    // Extract cursor location
    uint32_t pos;
    outb(addr_6845, 14);
c0102ca9:	0f b7 05 e6 7e 12 c0 	movzwl 0xc0127ee6,%eax
c0102cb0:	0f b7 c0             	movzwl %ax,%eax
c0102cb3:	66 89 45 f4          	mov    %ax,-0xc(%ebp)
c0102cb7:	c6 45 f3 0e          	movb   $0xe,-0xd(%ebp)
        : "memory", "cc");
}

static inline void
outb(uint16_t port, uint8_t data) {
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port));
c0102cbb:	0f b6 45 f3          	movzbl -0xd(%ebp),%eax
c0102cbf:	0f b7 55 f4          	movzwl -0xc(%ebp),%edx
c0102cc3:	ee                   	out    %al,(%dx)
    pos = inb(addr_6845 + 1) << 8;
c0102cc4:	0f b7 05 e6 7e 12 c0 	movzwl 0xc0127ee6,%eax
c0102ccb:	83 c0 01             	add    $0x1,%eax
c0102cce:	0f b7 c0             	movzwl %ax,%eax
c0102cd1:	66 89 45 f6          	mov    %ax,-0xa(%ebp)
static inline void invlpg(void *addr) __attribute__((always_inline));

static inline uint8_t
inb(uint16_t port) {
    uint8_t data;
    asm volatile ("inb %1, %0" : "=a" (data) : "d" (port));
c0102cd5:	0f b7 45 f6          	movzwl -0xa(%ebp),%eax
c0102cd9:	89 c2                	mov    %eax,%edx
c0102cdb:	ec                   	in     (%dx),%al
c0102cdc:	88 45 f8             	mov    %al,-0x8(%ebp)
    return data;
c0102cdf:	0f b6 45 f8          	movzbl -0x8(%ebp),%eax
c0102ce3:	0f b6 c0             	movzbl %al,%eax
c0102ce6:	c1 e0 08             	shl    $0x8,%eax
c0102ce9:	89 45 ec             	mov    %eax,-0x14(%ebp)
    outb(addr_6845, 15);
c0102cec:	0f b7 05 e6 7e 12 c0 	movzwl 0xc0127ee6,%eax
c0102cf3:	0f b7 c0             	movzwl %ax,%eax
c0102cf6:	66 89 45 fa          	mov    %ax,-0x6(%ebp)
c0102cfa:	c6 45 f9 0f          	movb   $0xf,-0x7(%ebp)
        : "memory", "cc");
}

static inline void
outb(uint16_t port, uint8_t data) {
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port));
c0102cfe:	0f b6 45 f9          	movzbl -0x7(%ebp),%eax
c0102d02:	0f b7 55 fa          	movzwl -0x6(%ebp),%edx
c0102d06:	ee                   	out    %al,(%dx)
    pos |= inb(addr_6845 + 1);
c0102d07:	0f b7 05 e6 7e 12 c0 	movzwl 0xc0127ee6,%eax
c0102d0e:	83 c0 01             	add    $0x1,%eax
c0102d11:	0f b7 c0             	movzwl %ax,%eax
c0102d14:	66 89 45 fc          	mov    %ax,-0x4(%ebp)
static inline void invlpg(void *addr) __attribute__((always_inline));

static inline uint8_t
inb(uint16_t port) {
    uint8_t data;
    asm volatile ("inb %1, %0" : "=a" (data) : "d" (port));
c0102d18:	0f b7 45 fc          	movzwl -0x4(%ebp),%eax
c0102d1c:	89 c2                	mov    %eax,%edx
c0102d1e:	ec                   	in     (%dx),%al
c0102d1f:	88 45 ff             	mov    %al,-0x1(%ebp)
    return data;
c0102d22:	0f b6 45 ff          	movzbl -0x1(%ebp),%eax
c0102d26:	0f b6 c0             	movzbl %al,%eax
c0102d29:	09 45 ec             	or     %eax,-0x14(%ebp)

    crt_buf = (uint16_t*) cp;
c0102d2c:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0102d2f:	a3 e0 7e 12 c0       	mov    %eax,0xc0127ee0
    crt_pos = pos;
c0102d34:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0102d37:	66 a3 e4 7e 12 c0    	mov    %ax,0xc0127ee4
}
c0102d3d:	c9                   	leave  
c0102d3e:	c3                   	ret    

c0102d3f <serial_init>:

static bool serial_exists = 0;

static void
serial_init(void) {
c0102d3f:	55                   	push   %ebp
c0102d40:	89 e5                	mov    %esp,%ebp
c0102d42:	83 ec 48             	sub    $0x48,%esp
c0102d45:	66 c7 45 d2 fa 03    	movw   $0x3fa,-0x2e(%ebp)
c0102d4b:	c6 45 d1 00          	movb   $0x0,-0x2f(%ebp)
        : "memory", "cc");
}

static inline void
outb(uint16_t port, uint8_t data) {
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port));
c0102d4f:	0f b6 45 d1          	movzbl -0x2f(%ebp),%eax
c0102d53:	0f b7 55 d2          	movzwl -0x2e(%ebp),%edx
c0102d57:	ee                   	out    %al,(%dx)
c0102d58:	66 c7 45 d6 fb 03    	movw   $0x3fb,-0x2a(%ebp)
c0102d5e:	c6 45 d5 80          	movb   $0x80,-0x2b(%ebp)
c0102d62:	0f b6 45 d5          	movzbl -0x2b(%ebp),%eax
c0102d66:	0f b7 55 d6          	movzwl -0x2a(%ebp),%edx
c0102d6a:	ee                   	out    %al,(%dx)
c0102d6b:	66 c7 45 da f8 03    	movw   $0x3f8,-0x26(%ebp)
c0102d71:	c6 45 d9 0c          	movb   $0xc,-0x27(%ebp)
c0102d75:	0f b6 45 d9          	movzbl -0x27(%ebp),%eax
c0102d79:	0f b7 55 da          	movzwl -0x26(%ebp),%edx
c0102d7d:	ee                   	out    %al,(%dx)
c0102d7e:	66 c7 45 de f9 03    	movw   $0x3f9,-0x22(%ebp)
c0102d84:	c6 45 dd 00          	movb   $0x0,-0x23(%ebp)
c0102d88:	0f b6 45 dd          	movzbl -0x23(%ebp),%eax
c0102d8c:	0f b7 55 de          	movzwl -0x22(%ebp),%edx
c0102d90:	ee                   	out    %al,(%dx)
c0102d91:	66 c7 45 e2 fb 03    	movw   $0x3fb,-0x1e(%ebp)
c0102d97:	c6 45 e1 03          	movb   $0x3,-0x1f(%ebp)
c0102d9b:	0f b6 45 e1          	movzbl -0x1f(%ebp),%eax
c0102d9f:	0f b7 55 e2          	movzwl -0x1e(%ebp),%edx
c0102da3:	ee                   	out    %al,(%dx)
c0102da4:	66 c7 45 e6 fc 03    	movw   $0x3fc,-0x1a(%ebp)
c0102daa:	c6 45 e5 00          	movb   $0x0,-0x1b(%ebp)
c0102dae:	0f b6 45 e5          	movzbl -0x1b(%ebp),%eax
c0102db2:	0f b7 55 e6          	movzwl -0x1a(%ebp),%edx
c0102db6:	ee                   	out    %al,(%dx)
c0102db7:	66 c7 45 ea f9 03    	movw   $0x3f9,-0x16(%ebp)
c0102dbd:	c6 45 e9 01          	movb   $0x1,-0x17(%ebp)
c0102dc1:	0f b6 45 e9          	movzbl -0x17(%ebp),%eax
c0102dc5:	0f b7 55 ea          	movzwl -0x16(%ebp),%edx
c0102dc9:	ee                   	out    %al,(%dx)
c0102dca:	66 c7 45 ec fd 03    	movw   $0x3fd,-0x14(%ebp)
static inline void invlpg(void *addr) __attribute__((always_inline));

static inline uint8_t
inb(uint16_t port) {
    uint8_t data;
    asm volatile ("inb %1, %0" : "=a" (data) : "d" (port));
c0102dd0:	0f b7 45 ec          	movzwl -0x14(%ebp),%eax
c0102dd4:	89 c2                	mov    %eax,%edx
c0102dd6:	ec                   	in     (%dx),%al
c0102dd7:	88 45 ef             	mov    %al,-0x11(%ebp)
    return data;
c0102dda:	0f b6 45 ef          	movzbl -0x11(%ebp),%eax
    // Enable rcv interrupts
    outb(COM1 + COM_IER, COM_IER_RDI);

    // Clear any preexisting overrun indications and interrupts
    // Serial port doesn't exist if COM_LSR returns 0xFF
    serial_exists = (inb(COM1 + COM_LSR) != 0xFF);
c0102dde:	3c ff                	cmp    $0xff,%al
c0102de0:	0f 95 c0             	setne  %al
c0102de3:	0f b6 c0             	movzbl %al,%eax
c0102de6:	a3 e8 7e 12 c0       	mov    %eax,0xc0127ee8
c0102deb:	66 c7 45 f0 fa 03    	movw   $0x3fa,-0x10(%ebp)
static inline void invlpg(void *addr) __attribute__((always_inline));

static inline uint8_t
inb(uint16_t port) {
    uint8_t data;
    asm volatile ("inb %1, %0" : "=a" (data) : "d" (port));
c0102df1:	0f b7 45 f0          	movzwl -0x10(%ebp),%eax
c0102df5:	89 c2                	mov    %eax,%edx
c0102df7:	ec                   	in     (%dx),%al
c0102df8:	88 45 f3             	mov    %al,-0xd(%ebp)
    return data;
c0102dfb:	66 c7 45 f4 f8 03    	movw   $0x3f8,-0xc(%ebp)
static inline void invlpg(void *addr) __attribute__((always_inline));

static inline uint8_t
inb(uint16_t port) {
    uint8_t data;
    asm volatile ("inb %1, %0" : "=a" (data) : "d" (port));
c0102e01:	0f b7 45 f4          	movzwl -0xc(%ebp),%eax
c0102e05:	89 c2                	mov    %eax,%edx
c0102e07:	ec                   	in     (%dx),%al
c0102e08:	88 45 f7             	mov    %al,-0x9(%ebp)
    (void) inb(COM1+COM_IIR);
    (void) inb(COM1+COM_RX);

    if (serial_exists) {
c0102e0b:	a1 e8 7e 12 c0       	mov    0xc0127ee8,%eax
c0102e10:	85 c0                	test   %eax,%eax
c0102e12:	74 0c                	je     c0102e20 <serial_init+0xe1>
        pic_enable(IRQ_COM1);
c0102e14:	c7 04 24 04 00 00 00 	movl   $0x4,(%esp)
c0102e1b:	e8 e0 06 00 00       	call   c0103500 <pic_enable>
    }
}
c0102e20:	c9                   	leave  
c0102e21:	c3                   	ret    

c0102e22 <lpt_putc_sub>:

static void
lpt_putc_sub(int c) {
c0102e22:	55                   	push   %ebp
c0102e23:	89 e5                	mov    %esp,%ebp
c0102e25:	83 ec 20             	sub    $0x20,%esp
    int i;
    for (i = 0; !(inb(LPTPORT + 1) & 0x80) && i < 12800; i ++) {
c0102e28:	c7 45 ec 00 00 00 00 	movl   $0x0,-0x14(%ebp)
c0102e2f:	eb 09                	jmp    c0102e3a <lpt_putc_sub+0x18>
        delay();
c0102e31:	e8 db fd ff ff       	call   c0102c11 <delay>
}

static void
lpt_putc_sub(int c) {
    int i;
    for (i = 0; !(inb(LPTPORT + 1) & 0x80) && i < 12800; i ++) {
c0102e36:	83 45 ec 01          	addl   $0x1,-0x14(%ebp)
c0102e3a:	66 c7 45 f2 79 03    	movw   $0x379,-0xe(%ebp)
c0102e40:	0f b7 45 f2          	movzwl -0xe(%ebp),%eax
c0102e44:	89 c2                	mov    %eax,%edx
c0102e46:	ec                   	in     (%dx),%al
c0102e47:	88 45 f4             	mov    %al,-0xc(%ebp)
    return data;
c0102e4a:	0f b6 45 f4          	movzbl -0xc(%ebp),%eax
c0102e4e:	84 c0                	test   %al,%al
c0102e50:	78 09                	js     c0102e5b <lpt_putc_sub+0x39>
c0102e52:	81 7d ec ff 31 00 00 	cmpl   $0x31ff,-0x14(%ebp)
c0102e59:	7e d6                	jle    c0102e31 <lpt_putc_sub+0xf>
        delay();
    }
    outb(LPTPORT + 0, c);
c0102e5b:	8b 45 08             	mov    0x8(%ebp),%eax
c0102e5e:	0f b6 c0             	movzbl %al,%eax
c0102e61:	66 c7 45 f6 78 03    	movw   $0x378,-0xa(%ebp)
c0102e67:	88 45 f5             	mov    %al,-0xb(%ebp)
        : "memory", "cc");
}

static inline void
outb(uint16_t port, uint8_t data) {
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port));
c0102e6a:	0f b6 45 f5          	movzbl -0xb(%ebp),%eax
c0102e6e:	0f b7 55 f6          	movzwl -0xa(%ebp),%edx
c0102e72:	ee                   	out    %al,(%dx)
c0102e73:	66 c7 45 fa 7a 03    	movw   $0x37a,-0x6(%ebp)
c0102e79:	c6 45 f9 0d          	movb   $0xd,-0x7(%ebp)
c0102e7d:	0f b6 45 f9          	movzbl -0x7(%ebp),%eax
c0102e81:	0f b7 55 fa          	movzwl -0x6(%ebp),%edx
c0102e85:	ee                   	out    %al,(%dx)
c0102e86:	66 c7 45 fe 7a 03    	movw   $0x37a,-0x2(%ebp)
c0102e8c:	c6 45 fd 08          	movb   $0x8,-0x3(%ebp)
c0102e90:	0f b6 45 fd          	movzbl -0x3(%ebp),%eax
c0102e94:	0f b7 55 fe          	movzwl -0x2(%ebp),%edx
c0102e98:	ee                   	out    %al,(%dx)
    outb(LPTPORT + 2, 0x08 | 0x04 | 0x01);
    outb(LPTPORT + 2, 0x08);
}
c0102e99:	c9                   	leave  
c0102e9a:	c3                   	ret    

c0102e9b <lpt_putc>:

/* lpt_putc - copy console output to parallel port */
static void
lpt_putc(int c) {
c0102e9b:	55                   	push   %ebp
c0102e9c:	89 e5                	mov    %esp,%ebp
c0102e9e:	83 ec 04             	sub    $0x4,%esp
    if (c != '\b') {
c0102ea1:	83 7d 08 08          	cmpl   $0x8,0x8(%ebp)
c0102ea5:	74 0d                	je     c0102eb4 <lpt_putc+0x19>
        lpt_putc_sub(c);
c0102ea7:	8b 45 08             	mov    0x8(%ebp),%eax
c0102eaa:	89 04 24             	mov    %eax,(%esp)
c0102ead:	e8 70 ff ff ff       	call   c0102e22 <lpt_putc_sub>
c0102eb2:	eb 24                	jmp    c0102ed8 <lpt_putc+0x3d>
    }
    else {
        lpt_putc_sub('\b');
c0102eb4:	c7 04 24 08 00 00 00 	movl   $0x8,(%esp)
c0102ebb:	e8 62 ff ff ff       	call   c0102e22 <lpt_putc_sub>
        lpt_putc_sub(' ');
c0102ec0:	c7 04 24 20 00 00 00 	movl   $0x20,(%esp)
c0102ec7:	e8 56 ff ff ff       	call   c0102e22 <lpt_putc_sub>
        lpt_putc_sub('\b');
c0102ecc:	c7 04 24 08 00 00 00 	movl   $0x8,(%esp)
c0102ed3:	e8 4a ff ff ff       	call   c0102e22 <lpt_putc_sub>
    }
}
c0102ed8:	c9                   	leave  
c0102ed9:	c3                   	ret    

c0102eda <cga_putc>:

/* cga_putc - print character to console */
static void
cga_putc(int c) {
c0102eda:	55                   	push   %ebp
c0102edb:	89 e5                	mov    %esp,%ebp
c0102edd:	53                   	push   %ebx
c0102ede:	83 ec 34             	sub    $0x34,%esp
    // set black on white
    if (!(c & ~0xFF)) {
c0102ee1:	8b 45 08             	mov    0x8(%ebp),%eax
c0102ee4:	b0 00                	mov    $0x0,%al
c0102ee6:	85 c0                	test   %eax,%eax
c0102ee8:	75 07                	jne    c0102ef1 <cga_putc+0x17>
        c |= 0x0700;
c0102eea:	81 4d 08 00 07 00 00 	orl    $0x700,0x8(%ebp)
    }

    switch (c & 0xff) {
c0102ef1:	8b 45 08             	mov    0x8(%ebp),%eax
c0102ef4:	25 ff 00 00 00       	and    $0xff,%eax
c0102ef9:	83 f8 0a             	cmp    $0xa,%eax
c0102efc:	74 4f                	je     c0102f4d <cga_putc+0x73>
c0102efe:	83 f8 0d             	cmp    $0xd,%eax
c0102f01:	74 5a                	je     c0102f5d <cga_putc+0x83>
c0102f03:	83 f8 08             	cmp    $0x8,%eax
c0102f06:	0f 85 8d 00 00 00    	jne    c0102f99 <cga_putc+0xbf>
    case '\b':
        if (crt_pos > 0) {
c0102f0c:	0f b7 05 e4 7e 12 c0 	movzwl 0xc0127ee4,%eax
c0102f13:	66 85 c0             	test   %ax,%ax
c0102f16:	0f 84 a3 00 00 00    	je     c0102fbf <cga_putc+0xe5>
            crt_pos --;
c0102f1c:	0f b7 05 e4 7e 12 c0 	movzwl 0xc0127ee4,%eax
c0102f23:	83 e8 01             	sub    $0x1,%eax
c0102f26:	66 a3 e4 7e 12 c0    	mov    %ax,0xc0127ee4
            crt_buf[crt_pos] = (c & ~0xff) | ' ';
c0102f2c:	a1 e0 7e 12 c0       	mov    0xc0127ee0,%eax
c0102f31:	0f b7 15 e4 7e 12 c0 	movzwl 0xc0127ee4,%edx
c0102f38:	0f b7 d2             	movzwl %dx,%edx
c0102f3b:	01 d2                	add    %edx,%edx
c0102f3d:	8d 14 10             	lea    (%eax,%edx,1),%edx
c0102f40:	8b 45 08             	mov    0x8(%ebp),%eax
c0102f43:	b0 00                	mov    $0x0,%al
c0102f45:	83 c8 20             	or     $0x20,%eax
c0102f48:	66 89 02             	mov    %ax,(%edx)
        }
        break;
c0102f4b:	eb 73                	jmp    c0102fc0 <cga_putc+0xe6>
    case '\n':
        crt_pos += CRT_COLS;
c0102f4d:	0f b7 05 e4 7e 12 c0 	movzwl 0xc0127ee4,%eax
c0102f54:	83 c0 50             	add    $0x50,%eax
c0102f57:	66 a3 e4 7e 12 c0    	mov    %ax,0xc0127ee4
    case '\r':
        crt_pos -= (crt_pos % CRT_COLS);
c0102f5d:	0f b7 1d e4 7e 12 c0 	movzwl 0xc0127ee4,%ebx
c0102f64:	0f b7 0d e4 7e 12 c0 	movzwl 0xc0127ee4,%ecx
c0102f6b:	0f b7 c1             	movzwl %cx,%eax
c0102f6e:	69 c0 cd cc 00 00    	imul   $0xcccd,%eax,%eax
c0102f74:	c1 e8 10             	shr    $0x10,%eax
c0102f77:	89 c2                	mov    %eax,%edx
c0102f79:	66 c1 ea 06          	shr    $0x6,%dx
c0102f7d:	89 d0                	mov    %edx,%eax
c0102f7f:	c1 e0 02             	shl    $0x2,%eax
c0102f82:	01 d0                	add    %edx,%eax
c0102f84:	c1 e0 04             	shl    $0x4,%eax
c0102f87:	89 ca                	mov    %ecx,%edx
c0102f89:	66 29 c2             	sub    %ax,%dx
c0102f8c:	89 d8                	mov    %ebx,%eax
c0102f8e:	66 29 d0             	sub    %dx,%ax
c0102f91:	66 a3 e4 7e 12 c0    	mov    %ax,0xc0127ee4
        break;
c0102f97:	eb 27                	jmp    c0102fc0 <cga_putc+0xe6>
    default:
        crt_buf[crt_pos ++] = c;     // write the character
c0102f99:	8b 15 e0 7e 12 c0    	mov    0xc0127ee0,%edx
c0102f9f:	0f b7 05 e4 7e 12 c0 	movzwl 0xc0127ee4,%eax
c0102fa6:	0f b7 c8             	movzwl %ax,%ecx
c0102fa9:	01 c9                	add    %ecx,%ecx
c0102fab:	8d 0c 0a             	lea    (%edx,%ecx,1),%ecx
c0102fae:	8b 55 08             	mov    0x8(%ebp),%edx
c0102fb1:	66 89 11             	mov    %dx,(%ecx)
c0102fb4:	83 c0 01             	add    $0x1,%eax
c0102fb7:	66 a3 e4 7e 12 c0    	mov    %ax,0xc0127ee4
c0102fbd:	eb 01                	jmp    c0102fc0 <cga_putc+0xe6>
    case '\b':
        if (crt_pos > 0) {
            crt_pos --;
            crt_buf[crt_pos] = (c & ~0xff) | ' ';
        }
        break;
c0102fbf:	90                   	nop
        crt_buf[crt_pos ++] = c;     // write the character
        break;
    }

    // What is the purpose of this?
    if (crt_pos >= CRT_SIZE) {
c0102fc0:	0f b7 05 e4 7e 12 c0 	movzwl 0xc0127ee4,%eax
c0102fc7:	66 3d cf 07          	cmp    $0x7cf,%ax
c0102fcb:	76 5b                	jbe    c0103028 <cga_putc+0x14e>
        int i;
        memmove(crt_buf, crt_buf + CRT_COLS, (CRT_SIZE - CRT_COLS) * sizeof(uint16_t));
c0102fcd:	a1 e0 7e 12 c0       	mov    0xc0127ee0,%eax
c0102fd2:	8d 90 a0 00 00 00    	lea    0xa0(%eax),%edx
c0102fd8:	a1 e0 7e 12 c0       	mov    0xc0127ee0,%eax
c0102fdd:	c7 44 24 08 00 0f 00 	movl   $0xf00,0x8(%esp)
c0102fe4:	00 
c0102fe5:	89 54 24 04          	mov    %edx,0x4(%esp)
c0102fe9:	89 04 24             	mov    %eax,(%esp)
c0102fec:	e8 91 7c 00 00       	call   c010ac82 <memmove>
        for (i = CRT_SIZE - CRT_COLS; i < CRT_SIZE; i ++) {
c0102ff1:	c7 45 e4 80 07 00 00 	movl   $0x780,-0x1c(%ebp)
c0102ff8:	eb 15                	jmp    c010300f <cga_putc+0x135>
            crt_buf[i] = 0x0700 | ' ';
c0102ffa:	a1 e0 7e 12 c0       	mov    0xc0127ee0,%eax
c0102fff:	8b 55 e4             	mov    -0x1c(%ebp),%edx
c0103002:	01 d2                	add    %edx,%edx
c0103004:	01 d0                	add    %edx,%eax
c0103006:	66 c7 00 20 07       	movw   $0x720,(%eax)

    // What is the purpose of this?
    if (crt_pos >= CRT_SIZE) {
        int i;
        memmove(crt_buf, crt_buf + CRT_COLS, (CRT_SIZE - CRT_COLS) * sizeof(uint16_t));
        for (i = CRT_SIZE - CRT_COLS; i < CRT_SIZE; i ++) {
c010300b:	83 45 e4 01          	addl   $0x1,-0x1c(%ebp)
c010300f:	81 7d e4 cf 07 00 00 	cmpl   $0x7cf,-0x1c(%ebp)
c0103016:	7e e2                	jle    c0102ffa <cga_putc+0x120>
            crt_buf[i] = 0x0700 | ' ';
        }
        crt_pos -= CRT_COLS;
c0103018:	0f b7 05 e4 7e 12 c0 	movzwl 0xc0127ee4,%eax
c010301f:	83 e8 50             	sub    $0x50,%eax
c0103022:	66 a3 e4 7e 12 c0    	mov    %ax,0xc0127ee4
    }

    // move that little blinky thing
    outb(addr_6845, 14);
c0103028:	0f b7 05 e6 7e 12 c0 	movzwl 0xc0127ee6,%eax
c010302f:	0f b7 c0             	movzwl %ax,%eax
c0103032:	66 89 45 ea          	mov    %ax,-0x16(%ebp)
c0103036:	c6 45 e9 0e          	movb   $0xe,-0x17(%ebp)
c010303a:	0f b6 45 e9          	movzbl -0x17(%ebp),%eax
c010303e:	0f b7 55 ea          	movzwl -0x16(%ebp),%edx
c0103042:	ee                   	out    %al,(%dx)
    outb(addr_6845 + 1, crt_pos >> 8);
c0103043:	0f b7 05 e4 7e 12 c0 	movzwl 0xc0127ee4,%eax
c010304a:	66 c1 e8 08          	shr    $0x8,%ax
c010304e:	0f b6 c0             	movzbl %al,%eax
c0103051:	0f b7 15 e6 7e 12 c0 	movzwl 0xc0127ee6,%edx
c0103058:	83 c2 01             	add    $0x1,%edx
c010305b:	0f b7 d2             	movzwl %dx,%edx
c010305e:	66 89 55 ee          	mov    %dx,-0x12(%ebp)
c0103062:	88 45 ed             	mov    %al,-0x13(%ebp)
c0103065:	0f b6 45 ed          	movzbl -0x13(%ebp),%eax
c0103069:	0f b7 55 ee          	movzwl -0x12(%ebp),%edx
c010306d:	ee                   	out    %al,(%dx)
    outb(addr_6845, 15);
c010306e:	0f b7 05 e6 7e 12 c0 	movzwl 0xc0127ee6,%eax
c0103075:	0f b7 c0             	movzwl %ax,%eax
c0103078:	66 89 45 f2          	mov    %ax,-0xe(%ebp)
c010307c:	c6 45 f1 0f          	movb   $0xf,-0xf(%ebp)
c0103080:	0f b6 45 f1          	movzbl -0xf(%ebp),%eax
c0103084:	0f b7 55 f2          	movzwl -0xe(%ebp),%edx
c0103088:	ee                   	out    %al,(%dx)
    outb(addr_6845 + 1, crt_pos);
c0103089:	0f b7 05 e4 7e 12 c0 	movzwl 0xc0127ee4,%eax
c0103090:	0f b6 c0             	movzbl %al,%eax
c0103093:	0f b7 15 e6 7e 12 c0 	movzwl 0xc0127ee6,%edx
c010309a:	83 c2 01             	add    $0x1,%edx
c010309d:	0f b7 d2             	movzwl %dx,%edx
c01030a0:	66 89 55 f6          	mov    %dx,-0xa(%ebp)
c01030a4:	88 45 f5             	mov    %al,-0xb(%ebp)
c01030a7:	0f b6 45 f5          	movzbl -0xb(%ebp),%eax
c01030ab:	0f b7 55 f6          	movzwl -0xa(%ebp),%edx
c01030af:	ee                   	out    %al,(%dx)
}
c01030b0:	83 c4 34             	add    $0x34,%esp
c01030b3:	5b                   	pop    %ebx
c01030b4:	5d                   	pop    %ebp
c01030b5:	c3                   	ret    

c01030b6 <serial_putc_sub>:

static void
serial_putc_sub(int c) {
c01030b6:	55                   	push   %ebp
c01030b7:	89 e5                	mov    %esp,%ebp
c01030b9:	83 ec 10             	sub    $0x10,%esp
    int i;
    for (i = 0; !(inb(COM1 + COM_LSR) & COM_LSR_TXRDY) && i < 12800; i ++) {
c01030bc:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
c01030c3:	eb 09                	jmp    c01030ce <serial_putc_sub+0x18>
        delay();
c01030c5:	e8 47 fb ff ff       	call   c0102c11 <delay>
}

static void
serial_putc_sub(int c) {
    int i;
    for (i = 0; !(inb(COM1 + COM_LSR) & COM_LSR_TXRDY) && i < 12800; i ++) {
c01030ca:	83 45 f4 01          	addl   $0x1,-0xc(%ebp)
c01030ce:	66 c7 45 fa fd 03    	movw   $0x3fd,-0x6(%ebp)
static inline void invlpg(void *addr) __attribute__((always_inline));

static inline uint8_t
inb(uint16_t port) {
    uint8_t data;
    asm volatile ("inb %1, %0" : "=a" (data) : "d" (port));
c01030d4:	0f b7 45 fa          	movzwl -0x6(%ebp),%eax
c01030d8:	89 c2                	mov    %eax,%edx
c01030da:	ec                   	in     (%dx),%al
c01030db:	88 45 fc             	mov    %al,-0x4(%ebp)
    return data;
c01030de:	0f b6 45 fc          	movzbl -0x4(%ebp),%eax
c01030e2:	0f b6 c0             	movzbl %al,%eax
c01030e5:	83 e0 20             	and    $0x20,%eax
c01030e8:	85 c0                	test   %eax,%eax
c01030ea:	75 09                	jne    c01030f5 <serial_putc_sub+0x3f>
c01030ec:	81 7d f4 ff 31 00 00 	cmpl   $0x31ff,-0xc(%ebp)
c01030f3:	7e d0                	jle    c01030c5 <serial_putc_sub+0xf>
        delay();
    }
    outb(COM1 + COM_TX, c);
c01030f5:	8b 45 08             	mov    0x8(%ebp),%eax
c01030f8:	0f b6 c0             	movzbl %al,%eax
c01030fb:	66 c7 45 fe f8 03    	movw   $0x3f8,-0x2(%ebp)
c0103101:	88 45 fd             	mov    %al,-0x3(%ebp)
        : "memory", "cc");
}

static inline void
outb(uint16_t port, uint8_t data) {
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port));
c0103104:	0f b6 45 fd          	movzbl -0x3(%ebp),%eax
c0103108:	0f b7 55 fe          	movzwl -0x2(%ebp),%edx
c010310c:	ee                   	out    %al,(%dx)
}
c010310d:	c9                   	leave  
c010310e:	c3                   	ret    

c010310f <serial_putc>:

/* serial_putc - print character to serial port */
static void
serial_putc(int c) {
c010310f:	55                   	push   %ebp
c0103110:	89 e5                	mov    %esp,%ebp
c0103112:	83 ec 04             	sub    $0x4,%esp
    if (c != '\b') {
c0103115:	83 7d 08 08          	cmpl   $0x8,0x8(%ebp)
c0103119:	74 0d                	je     c0103128 <serial_putc+0x19>
        serial_putc_sub(c);
c010311b:	8b 45 08             	mov    0x8(%ebp),%eax
c010311e:	89 04 24             	mov    %eax,(%esp)
c0103121:	e8 90 ff ff ff       	call   c01030b6 <serial_putc_sub>
c0103126:	eb 24                	jmp    c010314c <serial_putc+0x3d>
    }
    else {
        serial_putc_sub('\b');
c0103128:	c7 04 24 08 00 00 00 	movl   $0x8,(%esp)
c010312f:	e8 82 ff ff ff       	call   c01030b6 <serial_putc_sub>
        serial_putc_sub(' ');
c0103134:	c7 04 24 20 00 00 00 	movl   $0x20,(%esp)
c010313b:	e8 76 ff ff ff       	call   c01030b6 <serial_putc_sub>
        serial_putc_sub('\b');
c0103140:	c7 04 24 08 00 00 00 	movl   $0x8,(%esp)
c0103147:	e8 6a ff ff ff       	call   c01030b6 <serial_putc_sub>
    }
}
c010314c:	c9                   	leave  
c010314d:	c3                   	ret    

c010314e <cons_intr>:
/* *
 * cons_intr - called by device interrupt routines to feed input
 * characters into the circular console input buffer.
 * */
static void
cons_intr(int (*proc)(void)) {
c010314e:	55                   	push   %ebp
c010314f:	89 e5                	mov    %esp,%ebp
c0103151:	83 ec 18             	sub    $0x18,%esp
    int c;
    while ((c = (*proc)()) != -1) {
c0103154:	eb 32                	jmp    c0103188 <cons_intr+0x3a>
        if (c != 0) {
c0103156:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c010315a:	74 2c                	je     c0103188 <cons_intr+0x3a>
            cons.buf[cons.wpos ++] = c;
c010315c:	a1 04 81 12 c0       	mov    0xc0128104,%eax
c0103161:	8b 55 f4             	mov    -0xc(%ebp),%edx
c0103164:	88 90 00 7f 12 c0    	mov    %dl,-0x3fed8100(%eax)
c010316a:	83 c0 01             	add    $0x1,%eax
c010316d:	a3 04 81 12 c0       	mov    %eax,0xc0128104
            if (cons.wpos == CONSBUFSIZE) {
c0103172:	a1 04 81 12 c0       	mov    0xc0128104,%eax
c0103177:	3d 00 02 00 00       	cmp    $0x200,%eax
c010317c:	75 0a                	jne    c0103188 <cons_intr+0x3a>
                cons.wpos = 0;
c010317e:	c7 05 04 81 12 c0 00 	movl   $0x0,0xc0128104
c0103185:	00 00 00 
 * characters into the circular console input buffer.
 * */
static void
cons_intr(int (*proc)(void)) {
    int c;
    while ((c = (*proc)()) != -1) {
c0103188:	8b 45 08             	mov    0x8(%ebp),%eax
c010318b:	ff d0                	call   *%eax
c010318d:	89 45 f4             	mov    %eax,-0xc(%ebp)
c0103190:	83 7d f4 ff          	cmpl   $0xffffffff,-0xc(%ebp)
c0103194:	75 c0                	jne    c0103156 <cons_intr+0x8>
            if (cons.wpos == CONSBUFSIZE) {
                cons.wpos = 0;
            }
        }
    }
}
c0103196:	c9                   	leave  
c0103197:	c3                   	ret    

c0103198 <serial_proc_data>:

/* serial_proc_data - get data from serial port */
static int
serial_proc_data(void) {
c0103198:	55                   	push   %ebp
c0103199:	89 e5                	mov    %esp,%ebp
c010319b:	83 ec 10             	sub    $0x10,%esp
c010319e:	66 c7 45 f8 fd 03    	movw   $0x3fd,-0x8(%ebp)
static inline void invlpg(void *addr) __attribute__((always_inline));

static inline uint8_t
inb(uint16_t port) {
    uint8_t data;
    asm volatile ("inb %1, %0" : "=a" (data) : "d" (port));
c01031a4:	0f b7 45 f8          	movzwl -0x8(%ebp),%eax
c01031a8:	89 c2                	mov    %eax,%edx
c01031aa:	ec                   	in     (%dx),%al
c01031ab:	88 45 fb             	mov    %al,-0x5(%ebp)
    return data;
c01031ae:	0f b6 45 fb          	movzbl -0x5(%ebp),%eax
    if (!(inb(COM1 + COM_LSR) & COM_LSR_DATA)) {
c01031b2:	0f b6 c0             	movzbl %al,%eax
c01031b5:	83 e0 01             	and    $0x1,%eax
c01031b8:	85 c0                	test   %eax,%eax
c01031ba:	75 07                	jne    c01031c3 <serial_proc_data+0x2b>
        return -1;
c01031bc:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
c01031c1:	eb 2a                	jmp    c01031ed <serial_proc_data+0x55>
c01031c3:	66 c7 45 fc f8 03    	movw   $0x3f8,-0x4(%ebp)
static inline void invlpg(void *addr) __attribute__((always_inline));

static inline uint8_t
inb(uint16_t port) {
    uint8_t data;
    asm volatile ("inb %1, %0" : "=a" (data) : "d" (port));
c01031c9:	0f b7 45 fc          	movzwl -0x4(%ebp),%eax
c01031cd:	89 c2                	mov    %eax,%edx
c01031cf:	ec                   	in     (%dx),%al
c01031d0:	88 45 ff             	mov    %al,-0x1(%ebp)
    return data;
c01031d3:	0f b6 45 ff          	movzbl -0x1(%ebp),%eax
    }
    int c = inb(COM1 + COM_RX);
c01031d7:	0f b6 c0             	movzbl %al,%eax
c01031da:	89 45 f4             	mov    %eax,-0xc(%ebp)
    if (c == 127) {
c01031dd:	83 7d f4 7f          	cmpl   $0x7f,-0xc(%ebp)
c01031e1:	75 07                	jne    c01031ea <serial_proc_data+0x52>
        c = '\b';
c01031e3:	c7 45 f4 08 00 00 00 	movl   $0x8,-0xc(%ebp)
    }
    return c;
c01031ea:	8b 45 f4             	mov    -0xc(%ebp),%eax
}
c01031ed:	c9                   	leave  
c01031ee:	c3                   	ret    

c01031ef <serial_intr>:

/* serial_intr - try to feed input characters from serial port */
void
serial_intr(void) {
c01031ef:	55                   	push   %ebp
c01031f0:	89 e5                	mov    %esp,%ebp
c01031f2:	83 ec 18             	sub    $0x18,%esp
    if (serial_exists) {
c01031f5:	a1 e8 7e 12 c0       	mov    0xc0127ee8,%eax
c01031fa:	85 c0                	test   %eax,%eax
c01031fc:	74 0c                	je     c010320a <serial_intr+0x1b>
        cons_intr(serial_proc_data);
c01031fe:	c7 04 24 98 31 10 c0 	movl   $0xc0103198,(%esp)
c0103205:	e8 44 ff ff ff       	call   c010314e <cons_intr>
    }
}
c010320a:	c9                   	leave  
c010320b:	c3                   	ret    

c010320c <kbd_proc_data>:
 *
 * The kbd_proc_data() function gets data from the keyboard.
 * If we finish a character, return it, else 0. And return -1 if no data.
 * */
static int
kbd_proc_data(void) {
c010320c:	55                   	push   %ebp
c010320d:	89 e5                	mov    %esp,%ebp
c010320f:	83 ec 28             	sub    $0x28,%esp
c0103212:	66 c7 45 ee 64 00    	movw   $0x64,-0x12(%ebp)
static inline void invlpg(void *addr) __attribute__((always_inline));

static inline uint8_t
inb(uint16_t port) {
    uint8_t data;
    asm volatile ("inb %1, %0" : "=a" (data) : "d" (port));
c0103218:	0f b7 45 ee          	movzwl -0x12(%ebp),%eax
c010321c:	89 c2                	mov    %eax,%edx
c010321e:	ec                   	in     (%dx),%al
c010321f:	88 45 f1             	mov    %al,-0xf(%ebp)
    return data;
c0103222:	0f b6 45 f1          	movzbl -0xf(%ebp),%eax
    int c;
    uint8_t data;
    static uint32_t shift;

    if ((inb(KBSTATP) & KBS_DIB) == 0) {
c0103226:	0f b6 c0             	movzbl %al,%eax
c0103229:	83 e0 01             	and    $0x1,%eax
c010322c:	85 c0                	test   %eax,%eax
c010322e:	75 0a                	jne    c010323a <kbd_proc_data+0x2e>
        return -1;
c0103230:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
c0103235:	e9 5a 01 00 00       	jmp    c0103394 <kbd_proc_data+0x188>
c010323a:	66 c7 45 f2 60 00    	movw   $0x60,-0xe(%ebp)
static inline void invlpg(void *addr) __attribute__((always_inline));

static inline uint8_t
inb(uint16_t port) {
    uint8_t data;
    asm volatile ("inb %1, %0" : "=a" (data) : "d" (port));
c0103240:	0f b7 45 f2          	movzwl -0xe(%ebp),%eax
c0103244:	89 c2                	mov    %eax,%edx
c0103246:	ec                   	in     (%dx),%al
c0103247:	88 45 f4             	mov    %al,-0xc(%ebp)
    return data;
c010324a:	0f b6 45 f4          	movzbl -0xc(%ebp),%eax
    }

    data = inb(KBDATAP);
c010324e:	88 45 ed             	mov    %al,-0x13(%ebp)

    if (data == 0xE0) {
c0103251:	80 7d ed e0          	cmpb   $0xe0,-0x13(%ebp)
c0103255:	75 17                	jne    c010326e <kbd_proc_data+0x62>
        // E0 escape character
        shift |= E0ESC;
c0103257:	a1 08 81 12 c0       	mov    0xc0128108,%eax
c010325c:	83 c8 40             	or     $0x40,%eax
c010325f:	a3 08 81 12 c0       	mov    %eax,0xc0128108
        return 0;
c0103264:	b8 00 00 00 00       	mov    $0x0,%eax
c0103269:	e9 26 01 00 00       	jmp    c0103394 <kbd_proc_data+0x188>
    } else if (data & 0x80) {
c010326e:	0f b6 45 ed          	movzbl -0x13(%ebp),%eax
c0103272:	84 c0                	test   %al,%al
c0103274:	79 47                	jns    c01032bd <kbd_proc_data+0xb1>
        // Key released
        data = (shift & E0ESC ? data : data & 0x7F);
c0103276:	a1 08 81 12 c0       	mov    0xc0128108,%eax
c010327b:	83 e0 40             	and    $0x40,%eax
c010327e:	85 c0                	test   %eax,%eax
c0103280:	75 09                	jne    c010328b <kbd_proc_data+0x7f>
c0103282:	0f b6 45 ed          	movzbl -0x13(%ebp),%eax
c0103286:	83 e0 7f             	and    $0x7f,%eax
c0103289:	eb 04                	jmp    c010328f <kbd_proc_data+0x83>
c010328b:	0f b6 45 ed          	movzbl -0x13(%ebp),%eax
c010328f:	88 45 ed             	mov    %al,-0x13(%ebp)
        shift &= ~(shiftcode[data] | E0ESC);
c0103292:	0f b6 45 ed          	movzbl -0x13(%ebp),%eax
c0103296:	0f b6 80 c0 70 12 c0 	movzbl -0x3fed8f40(%eax),%eax
c010329d:	83 c8 40             	or     $0x40,%eax
c01032a0:	0f b6 c0             	movzbl %al,%eax
c01032a3:	f7 d0                	not    %eax
c01032a5:	89 c2                	mov    %eax,%edx
c01032a7:	a1 08 81 12 c0       	mov    0xc0128108,%eax
c01032ac:	21 d0                	and    %edx,%eax
c01032ae:	a3 08 81 12 c0       	mov    %eax,0xc0128108
        return 0;
c01032b3:	b8 00 00 00 00       	mov    $0x0,%eax
c01032b8:	e9 d7 00 00 00       	jmp    c0103394 <kbd_proc_data+0x188>
    } else if (shift & E0ESC) {
c01032bd:	a1 08 81 12 c0       	mov    0xc0128108,%eax
c01032c2:	83 e0 40             	and    $0x40,%eax
c01032c5:	85 c0                	test   %eax,%eax
c01032c7:	74 11                	je     c01032da <kbd_proc_data+0xce>
        // Last character was an E0 escape; or with 0x80
        data |= 0x80;
c01032c9:	80 4d ed 80          	orb    $0x80,-0x13(%ebp)
        shift &= ~E0ESC;
c01032cd:	a1 08 81 12 c0       	mov    0xc0128108,%eax
c01032d2:	83 e0 bf             	and    $0xffffffbf,%eax
c01032d5:	a3 08 81 12 c0       	mov    %eax,0xc0128108
    }

    shift |= shiftcode[data];
c01032da:	0f b6 45 ed          	movzbl -0x13(%ebp),%eax
c01032de:	0f b6 80 c0 70 12 c0 	movzbl -0x3fed8f40(%eax),%eax
c01032e5:	0f b6 d0             	movzbl %al,%edx
c01032e8:	a1 08 81 12 c0       	mov    0xc0128108,%eax
c01032ed:	09 d0                	or     %edx,%eax
c01032ef:	a3 08 81 12 c0       	mov    %eax,0xc0128108
    shift ^= togglecode[data];
c01032f4:	0f b6 45 ed          	movzbl -0x13(%ebp),%eax
c01032f8:	0f b6 80 c0 71 12 c0 	movzbl -0x3fed8e40(%eax),%eax
c01032ff:	0f b6 d0             	movzbl %al,%edx
c0103302:	a1 08 81 12 c0       	mov    0xc0128108,%eax
c0103307:	31 d0                	xor    %edx,%eax
c0103309:	a3 08 81 12 c0       	mov    %eax,0xc0128108

    c = charcode[shift & (CTL | SHIFT)][data];
c010330e:	a1 08 81 12 c0       	mov    0xc0128108,%eax
c0103313:	83 e0 03             	and    $0x3,%eax
c0103316:	8b 14 85 c0 75 12 c0 	mov    -0x3fed8a40(,%eax,4),%edx
c010331d:	0f b6 45 ed          	movzbl -0x13(%ebp),%eax
c0103321:	8d 04 02             	lea    (%edx,%eax,1),%eax
c0103324:	0f b6 00             	movzbl (%eax),%eax
c0103327:	0f b6 c0             	movzbl %al,%eax
c010332a:	89 45 e8             	mov    %eax,-0x18(%ebp)
    if (shift & CAPSLOCK) {
c010332d:	a1 08 81 12 c0       	mov    0xc0128108,%eax
c0103332:	83 e0 08             	and    $0x8,%eax
c0103335:	85 c0                	test   %eax,%eax
c0103337:	74 22                	je     c010335b <kbd_proc_data+0x14f>
        if ('a' <= c && c <= 'z')
c0103339:	83 7d e8 60          	cmpl   $0x60,-0x18(%ebp)
c010333d:	7e 0c                	jle    c010334b <kbd_proc_data+0x13f>
c010333f:	83 7d e8 7a          	cmpl   $0x7a,-0x18(%ebp)
c0103343:	7f 06                	jg     c010334b <kbd_proc_data+0x13f>
            c += 'A' - 'a';
c0103345:	83 6d e8 20          	subl   $0x20,-0x18(%ebp)
    shift |= shiftcode[data];
    shift ^= togglecode[data];

    c = charcode[shift & (CTL | SHIFT)][data];
    if (shift & CAPSLOCK) {
        if ('a' <= c && c <= 'z')
c0103349:	eb 10                	jmp    c010335b <kbd_proc_data+0x14f>
            c += 'A' - 'a';
        else if ('A' <= c && c <= 'Z')
c010334b:	83 7d e8 40          	cmpl   $0x40,-0x18(%ebp)
c010334f:	7e 0a                	jle    c010335b <kbd_proc_data+0x14f>
c0103351:	83 7d e8 5a          	cmpl   $0x5a,-0x18(%ebp)
c0103355:	7f 04                	jg     c010335b <kbd_proc_data+0x14f>
            c += 'a' - 'A';
c0103357:	83 45 e8 20          	addl   $0x20,-0x18(%ebp)
    }

    // Process special keys
    // Ctrl-Alt-Del: reboot
    if (!(~shift & (CTL | ALT)) && c == KEY_DEL) {
c010335b:	a1 08 81 12 c0       	mov    0xc0128108,%eax
c0103360:	f7 d0                	not    %eax
c0103362:	83 e0 06             	and    $0x6,%eax
c0103365:	85 c0                	test   %eax,%eax
c0103367:	75 28                	jne    c0103391 <kbd_proc_data+0x185>
c0103369:	81 7d e8 e9 00 00 00 	cmpl   $0xe9,-0x18(%ebp)
c0103370:	75 1f                	jne    c0103391 <kbd_proc_data+0x185>
        cprintf("Rebooting!\n");
c0103372:	c7 04 24 78 b8 10 c0 	movl   $0xc010b878,(%esp)
c0103379:	e8 4e e2 ff ff       	call   c01015cc <cprintf>
c010337e:	66 c7 45 f6 92 00    	movw   $0x92,-0xa(%ebp)
c0103384:	c6 45 f5 03          	movb   $0x3,-0xb(%ebp)
        : "memory", "cc");
}

static inline void
outb(uint16_t port, uint8_t data) {
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port));
c0103388:	0f b6 45 f5          	movzbl -0xb(%ebp),%eax
c010338c:	0f b7 55 f6          	movzwl -0xa(%ebp),%edx
c0103390:	ee                   	out    %al,(%dx)
        outb(0x92, 0x3); // courtesy of Chris Frost
    }
    return c;
c0103391:	8b 45 e8             	mov    -0x18(%ebp),%eax
}
c0103394:	c9                   	leave  
c0103395:	c3                   	ret    

c0103396 <kbd_intr>:

/* kbd_intr - try to feed input characters from keyboard */
static void
kbd_intr(void) {
c0103396:	55                   	push   %ebp
c0103397:	89 e5                	mov    %esp,%ebp
c0103399:	83 ec 18             	sub    $0x18,%esp
    cons_intr(kbd_proc_data);
c010339c:	c7 04 24 0c 32 10 c0 	movl   $0xc010320c,(%esp)
c01033a3:	e8 a6 fd ff ff       	call   c010314e <cons_intr>
}
c01033a8:	c9                   	leave  
c01033a9:	c3                   	ret    

c01033aa <kbd_init>:

static void
kbd_init(void) {
c01033aa:	55                   	push   %ebp
c01033ab:	89 e5                	mov    %esp,%ebp
c01033ad:	83 ec 18             	sub    $0x18,%esp
    // drain the kbd buffer
    kbd_intr();
c01033b0:	e8 e1 ff ff ff       	call   c0103396 <kbd_intr>
    pic_enable(IRQ_KBD);
c01033b5:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
c01033bc:	e8 3f 01 00 00       	call   c0103500 <pic_enable>
}
c01033c1:	c9                   	leave  
c01033c2:	c3                   	ret    

c01033c3 <cons_init>:

/* cons_init - initializes the console devices */
void
cons_init(void) {
c01033c3:	55                   	push   %ebp
c01033c4:	89 e5                	mov    %esp,%ebp
c01033c6:	83 ec 18             	sub    $0x18,%esp
    cga_init();
c01033c9:	e8 8b f8 ff ff       	call   c0102c59 <cga_init>
    serial_init();
c01033ce:	e8 6c f9 ff ff       	call   c0102d3f <serial_init>
    kbd_init();
c01033d3:	e8 d2 ff ff ff       	call   c01033aa <kbd_init>
    if (!serial_exists) {
c01033d8:	a1 e8 7e 12 c0       	mov    0xc0127ee8,%eax
c01033dd:	85 c0                	test   %eax,%eax
c01033df:	75 0c                	jne    c01033ed <cons_init+0x2a>
        cprintf("serial port does not exist!!\n");
c01033e1:	c7 04 24 84 b8 10 c0 	movl   $0xc010b884,(%esp)
c01033e8:	e8 df e1 ff ff       	call   c01015cc <cprintf>
    }
}
c01033ed:	c9                   	leave  
c01033ee:	c3                   	ret    

c01033ef <cons_putc>:

/* cons_putc - print a single character @c to console devices */
void
cons_putc(int c) {
c01033ef:	55                   	push   %ebp
c01033f0:	89 e5                	mov    %esp,%ebp
c01033f2:	83 ec 28             	sub    $0x28,%esp
    bool intr_flag;
    local_intr_save(intr_flag);
c01033f5:	e8 da f7 ff ff       	call   c0102bd4 <__intr_save>
c01033fa:	89 45 f4             	mov    %eax,-0xc(%ebp)
    {
        lpt_putc(c);
c01033fd:	8b 45 08             	mov    0x8(%ebp),%eax
c0103400:	89 04 24             	mov    %eax,(%esp)
c0103403:	e8 93 fa ff ff       	call   c0102e9b <lpt_putc>
        cga_putc(c);
c0103408:	8b 45 08             	mov    0x8(%ebp),%eax
c010340b:	89 04 24             	mov    %eax,(%esp)
c010340e:	e8 c7 fa ff ff       	call   c0102eda <cga_putc>
        serial_putc(c);
c0103413:	8b 45 08             	mov    0x8(%ebp),%eax
c0103416:	89 04 24             	mov    %eax,(%esp)
c0103419:	e8 f1 fc ff ff       	call   c010310f <serial_putc>
    }
    local_intr_restore(intr_flag);
c010341e:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0103421:	89 04 24             	mov    %eax,(%esp)
c0103424:	e8 d5 f7 ff ff       	call   c0102bfe <__intr_restore>
}
c0103429:	c9                   	leave  
c010342a:	c3                   	ret    

c010342b <cons_getc>:
/* *
 * cons_getc - return the next input character from console,
 * or 0 if none waiting.
 * */
int
cons_getc(void) {
c010342b:	55                   	push   %ebp
c010342c:	89 e5                	mov    %esp,%ebp
c010342e:	83 ec 28             	sub    $0x28,%esp
    int c = 0;
c0103431:	c7 45 f0 00 00 00 00 	movl   $0x0,-0x10(%ebp)
    bool intr_flag;
    local_intr_save(intr_flag);
c0103438:	e8 97 f7 ff ff       	call   c0102bd4 <__intr_save>
c010343d:	89 45 f4             	mov    %eax,-0xc(%ebp)
    {
        // poll for any pending input characters,
        // so that this function works even when interrupts are disabled
        // (e.g., when called from the kernel monitor).
        serial_intr();
c0103440:	e8 aa fd ff ff       	call   c01031ef <serial_intr>
        kbd_intr();
c0103445:	e8 4c ff ff ff       	call   c0103396 <kbd_intr>

        // grab the next character from the input buffer.
        if (cons.rpos != cons.wpos) {
c010344a:	8b 15 00 81 12 c0    	mov    0xc0128100,%edx
c0103450:	a1 04 81 12 c0       	mov    0xc0128104,%eax
c0103455:	39 c2                	cmp    %eax,%edx
c0103457:	74 30                	je     c0103489 <cons_getc+0x5e>
            c = cons.buf[cons.rpos ++];
c0103459:	a1 00 81 12 c0       	mov    0xc0128100,%eax
c010345e:	0f b6 90 00 7f 12 c0 	movzbl -0x3fed8100(%eax),%edx
c0103465:	0f b6 d2             	movzbl %dl,%edx
c0103468:	89 55 f0             	mov    %edx,-0x10(%ebp)
c010346b:	83 c0 01             	add    $0x1,%eax
c010346e:	a3 00 81 12 c0       	mov    %eax,0xc0128100
            if (cons.rpos == CONSBUFSIZE) {
c0103473:	a1 00 81 12 c0       	mov    0xc0128100,%eax
c0103478:	3d 00 02 00 00       	cmp    $0x200,%eax
c010347d:	75 0a                	jne    c0103489 <cons_getc+0x5e>
                cons.rpos = 0;
c010347f:	c7 05 00 81 12 c0 00 	movl   $0x0,0xc0128100
c0103486:	00 00 00 
            }
        }
    }
    local_intr_restore(intr_flag);
c0103489:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010348c:	89 04 24             	mov    %eax,(%esp)
c010348f:	e8 6a f7 ff ff       	call   c0102bfe <__intr_restore>
    return c;
c0103494:	8b 45 f0             	mov    -0x10(%ebp),%eax
}
c0103497:	c9                   	leave  
c0103498:	c3                   	ret    
c0103499:	00 00                	add    %al,(%eax)
	...

c010349c <intr_enable>:
#include <x86.h>
#include <intr.h>

/* intr_enable - enable irq interrupt */
void
intr_enable(void) {
c010349c:	55                   	push   %ebp
c010349d:	89 e5                	mov    %esp,%ebp
    asm volatile ("lidt (%0)" :: "r" (pd));
}

static inline void
sti(void) {
    asm volatile ("sti");
c010349f:	fb                   	sti    
    sti();
}
c01034a0:	5d                   	pop    %ebp
c01034a1:	c3                   	ret    

c01034a2 <intr_disable>:

/* intr_disable - disable irq interrupt */
void
intr_disable(void) {
c01034a2:	55                   	push   %ebp
c01034a3:	89 e5                	mov    %esp,%ebp
}

static inline void
cli(void) {
    asm volatile ("cli");
c01034a5:	fa                   	cli    
    cli();
}
c01034a6:	5d                   	pop    %ebp
c01034a7:	c3                   	ret    

c01034a8 <pic_setmask>:
// Initial IRQ mask has interrupt 2 enabled (for slave 8259A).
static uint16_t irq_mask = 0xFFFF & ~(1 << IRQ_SLAVE);
static bool did_init = 0;

static void
pic_setmask(uint16_t mask) {
c01034a8:	55                   	push   %ebp
c01034a9:	89 e5                	mov    %esp,%ebp
c01034ab:	83 ec 14             	sub    $0x14,%esp
c01034ae:	8b 45 08             	mov    0x8(%ebp),%eax
c01034b1:	66 89 45 ec          	mov    %ax,-0x14(%ebp)
    irq_mask = mask;
c01034b5:	0f b7 45 ec          	movzwl -0x14(%ebp),%eax
c01034b9:	66 a3 d0 75 12 c0    	mov    %ax,0xc01275d0
    if (did_init) {
c01034bf:	a1 0c 81 12 c0       	mov    0xc012810c,%eax
c01034c4:	85 c0                	test   %eax,%eax
c01034c6:	74 36                	je     c01034fe <pic_setmask+0x56>
        outb(IO_PIC1 + 1, mask);
c01034c8:	0f b7 45 ec          	movzwl -0x14(%ebp),%eax
c01034cc:	0f b6 c0             	movzbl %al,%eax
c01034cf:	66 c7 45 fa 21 00    	movw   $0x21,-0x6(%ebp)
c01034d5:	88 45 f9             	mov    %al,-0x7(%ebp)
        : "memory", "cc");
}

static inline void
outb(uint16_t port, uint8_t data) {
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port));
c01034d8:	0f b6 45 f9          	movzbl -0x7(%ebp),%eax
c01034dc:	0f b7 55 fa          	movzwl -0x6(%ebp),%edx
c01034e0:	ee                   	out    %al,(%dx)
        outb(IO_PIC2 + 1, mask >> 8);
c01034e1:	0f b7 45 ec          	movzwl -0x14(%ebp),%eax
c01034e5:	66 c1 e8 08          	shr    $0x8,%ax
c01034e9:	0f b6 c0             	movzbl %al,%eax
c01034ec:	66 c7 45 fe a1 00    	movw   $0xa1,-0x2(%ebp)
c01034f2:	88 45 fd             	mov    %al,-0x3(%ebp)
c01034f5:	0f b6 45 fd          	movzbl -0x3(%ebp),%eax
c01034f9:	0f b7 55 fe          	movzwl -0x2(%ebp),%edx
c01034fd:	ee                   	out    %al,(%dx)
    }
}
c01034fe:	c9                   	leave  
c01034ff:	c3                   	ret    

c0103500 <pic_enable>:

void
pic_enable(unsigned int irq) {
c0103500:	55                   	push   %ebp
c0103501:	89 e5                	mov    %esp,%ebp
c0103503:	53                   	push   %ebx
c0103504:	83 ec 04             	sub    $0x4,%esp
    pic_setmask(irq_mask & ~(1 << irq));
c0103507:	8b 45 08             	mov    0x8(%ebp),%eax
c010350a:	ba 01 00 00 00       	mov    $0x1,%edx
c010350f:	89 d3                	mov    %edx,%ebx
c0103511:	89 c1                	mov    %eax,%ecx
c0103513:	d3 e3                	shl    %cl,%ebx
c0103515:	89 d8                	mov    %ebx,%eax
c0103517:	89 c2                	mov    %eax,%edx
c0103519:	f7 d2                	not    %edx
c010351b:	0f b7 05 d0 75 12 c0 	movzwl 0xc01275d0,%eax
c0103522:	21 d0                	and    %edx,%eax
c0103524:	0f b7 c0             	movzwl %ax,%eax
c0103527:	89 04 24             	mov    %eax,(%esp)
c010352a:	e8 79 ff ff ff       	call   c01034a8 <pic_setmask>
}
c010352f:	83 c4 04             	add    $0x4,%esp
c0103532:	5b                   	pop    %ebx
c0103533:	5d                   	pop    %ebp
c0103534:	c3                   	ret    

c0103535 <pic_init>:

/* pic_init - initialize the 8259A interrupt controllers */
void
pic_init(void) {
c0103535:	55                   	push   %ebp
c0103536:	89 e5                	mov    %esp,%ebp
c0103538:	83 ec 44             	sub    $0x44,%esp
    did_init = 1;
c010353b:	c7 05 0c 81 12 c0 01 	movl   $0x1,0xc012810c
c0103542:	00 00 00 
c0103545:	66 c7 45 ca 21 00    	movw   $0x21,-0x36(%ebp)
c010354b:	c6 45 c9 ff          	movb   $0xff,-0x37(%ebp)
c010354f:	0f b6 45 c9          	movzbl -0x37(%ebp),%eax
c0103553:	0f b7 55 ca          	movzwl -0x36(%ebp),%edx
c0103557:	ee                   	out    %al,(%dx)
c0103558:	66 c7 45 ce a1 00    	movw   $0xa1,-0x32(%ebp)
c010355e:	c6 45 cd ff          	movb   $0xff,-0x33(%ebp)
c0103562:	0f b6 45 cd          	movzbl -0x33(%ebp),%eax
c0103566:	0f b7 55 ce          	movzwl -0x32(%ebp),%edx
c010356a:	ee                   	out    %al,(%dx)
c010356b:	66 c7 45 d2 20 00    	movw   $0x20,-0x2e(%ebp)
c0103571:	c6 45 d1 11          	movb   $0x11,-0x2f(%ebp)
c0103575:	0f b6 45 d1          	movzbl -0x2f(%ebp),%eax
c0103579:	0f b7 55 d2          	movzwl -0x2e(%ebp),%edx
c010357d:	ee                   	out    %al,(%dx)
c010357e:	66 c7 45 d6 21 00    	movw   $0x21,-0x2a(%ebp)
c0103584:	c6 45 d5 20          	movb   $0x20,-0x2b(%ebp)
c0103588:	0f b6 45 d5          	movzbl -0x2b(%ebp),%eax
c010358c:	0f b7 55 d6          	movzwl -0x2a(%ebp),%edx
c0103590:	ee                   	out    %al,(%dx)
c0103591:	66 c7 45 da 21 00    	movw   $0x21,-0x26(%ebp)
c0103597:	c6 45 d9 04          	movb   $0x4,-0x27(%ebp)
c010359b:	0f b6 45 d9          	movzbl -0x27(%ebp),%eax
c010359f:	0f b7 55 da          	movzwl -0x26(%ebp),%edx
c01035a3:	ee                   	out    %al,(%dx)
c01035a4:	66 c7 45 de 21 00    	movw   $0x21,-0x22(%ebp)
c01035aa:	c6 45 dd 03          	movb   $0x3,-0x23(%ebp)
c01035ae:	0f b6 45 dd          	movzbl -0x23(%ebp),%eax
c01035b2:	0f b7 55 de          	movzwl -0x22(%ebp),%edx
c01035b6:	ee                   	out    %al,(%dx)
c01035b7:	66 c7 45 e2 a0 00    	movw   $0xa0,-0x1e(%ebp)
c01035bd:	c6 45 e1 11          	movb   $0x11,-0x1f(%ebp)
c01035c1:	0f b6 45 e1          	movzbl -0x1f(%ebp),%eax
c01035c5:	0f b7 55 e2          	movzwl -0x1e(%ebp),%edx
c01035c9:	ee                   	out    %al,(%dx)
c01035ca:	66 c7 45 e6 a1 00    	movw   $0xa1,-0x1a(%ebp)
c01035d0:	c6 45 e5 28          	movb   $0x28,-0x1b(%ebp)
c01035d4:	0f b6 45 e5          	movzbl -0x1b(%ebp),%eax
c01035d8:	0f b7 55 e6          	movzwl -0x1a(%ebp),%edx
c01035dc:	ee                   	out    %al,(%dx)
c01035dd:	66 c7 45 ea a1 00    	movw   $0xa1,-0x16(%ebp)
c01035e3:	c6 45 e9 02          	movb   $0x2,-0x17(%ebp)
c01035e7:	0f b6 45 e9          	movzbl -0x17(%ebp),%eax
c01035eb:	0f b7 55 ea          	movzwl -0x16(%ebp),%edx
c01035ef:	ee                   	out    %al,(%dx)
c01035f0:	66 c7 45 ee a1 00    	movw   $0xa1,-0x12(%ebp)
c01035f6:	c6 45 ed 03          	movb   $0x3,-0x13(%ebp)
c01035fa:	0f b6 45 ed          	movzbl -0x13(%ebp),%eax
c01035fe:	0f b7 55 ee          	movzwl -0x12(%ebp),%edx
c0103602:	ee                   	out    %al,(%dx)
c0103603:	66 c7 45 f2 20 00    	movw   $0x20,-0xe(%ebp)
c0103609:	c6 45 f1 68          	movb   $0x68,-0xf(%ebp)
c010360d:	0f b6 45 f1          	movzbl -0xf(%ebp),%eax
c0103611:	0f b7 55 f2          	movzwl -0xe(%ebp),%edx
c0103615:	ee                   	out    %al,(%dx)
c0103616:	66 c7 45 f6 20 00    	movw   $0x20,-0xa(%ebp)
c010361c:	c6 45 f5 0a          	movb   $0xa,-0xb(%ebp)
c0103620:	0f b6 45 f5          	movzbl -0xb(%ebp),%eax
c0103624:	0f b7 55 f6          	movzwl -0xa(%ebp),%edx
c0103628:	ee                   	out    %al,(%dx)
c0103629:	66 c7 45 fa a0 00    	movw   $0xa0,-0x6(%ebp)
c010362f:	c6 45 f9 68          	movb   $0x68,-0x7(%ebp)
c0103633:	0f b6 45 f9          	movzbl -0x7(%ebp),%eax
c0103637:	0f b7 55 fa          	movzwl -0x6(%ebp),%edx
c010363b:	ee                   	out    %al,(%dx)
c010363c:	66 c7 45 fe a0 00    	movw   $0xa0,-0x2(%ebp)
c0103642:	c6 45 fd 0a          	movb   $0xa,-0x3(%ebp)
c0103646:	0f b6 45 fd          	movzbl -0x3(%ebp),%eax
c010364a:	0f b7 55 fe          	movzwl -0x2(%ebp),%edx
c010364e:	ee                   	out    %al,(%dx)
    outb(IO_PIC1, 0x0a);    // read IRR by default

    outb(IO_PIC2, 0x68);    // OCW3
    outb(IO_PIC2, 0x0a);    // OCW3

    if (irq_mask != 0xFFFF) {
c010364f:	0f b7 05 d0 75 12 c0 	movzwl 0xc01275d0,%eax
c0103656:	66 83 f8 ff          	cmp    $0xffffffff,%ax
c010365a:	74 12                	je     c010366e <pic_init+0x139>
        pic_setmask(irq_mask);
c010365c:	0f b7 05 d0 75 12 c0 	movzwl 0xc01275d0,%eax
c0103663:	0f b7 c0             	movzwl %ax,%eax
c0103666:	89 04 24             	mov    %eax,(%esp)
c0103669:	e8 3a fe ff ff       	call   c01034a8 <pic_setmask>
    }
}
c010366e:	c9                   	leave  
c010366f:	c3                   	ret    

c0103670 <print_ticks>:
#include <vmm.h>
#include <kdebug.h>

#define TICK_NUM 100

static void print_ticks() {
c0103670:	55                   	push   %ebp
c0103671:	89 e5                	mov    %esp,%ebp
c0103673:	83 ec 18             	sub    $0x18,%esp
    cprintf("%d ticks\n",TICK_NUM);
c0103676:	c7 44 24 04 64 00 00 	movl   $0x64,0x4(%esp)
c010367d:	00 
c010367e:	c7 04 24 c0 b8 10 c0 	movl   $0xc010b8c0,(%esp)
c0103685:	e8 42 df ff ff       	call   c01015cc <cprintf>
#ifdef DEBUG_GRADE
    cprintf("End of Test.\n");
c010368a:	c7 04 24 ca b8 10 c0 	movl   $0xc010b8ca,(%esp)
c0103691:	e8 36 df ff ff       	call   c01015cc <cprintf>
    panic("EOT: kernel seems ok.");
c0103696:	c7 44 24 08 d8 b8 10 	movl   $0xc010b8d8,0x8(%esp)
c010369d:	c0 
c010369e:	c7 44 24 04 13 00 00 	movl   $0x13,0x4(%esp)
c01036a5:	00 
c01036a6:	c7 04 24 ee b8 10 c0 	movl   $0xc010b8ee,(%esp)
c01036ad:	e8 fe f3 ff ff       	call   c0102ab0 <__panic>

c01036b2 <idt_init>:
static struct pseudodesc idt_pd = {
    sizeof(idt) - 1, (uintptr_t)idt
};

void
idt_init(void) {
c01036b2:	55                   	push   %ebp
c01036b3:	89 e5                	mov    %esp,%ebp
c01036b5:	83 ec 10             	sub    $0x10,%esp
    extern uintptr_t __vectors[];
    int i;
    for (i = 0; i < sizeof(idt) / sizeof(struct gatedesc); i ++) {
c01036b8:	c7 45 f8 00 00 00 00 	movl   $0x0,-0x8(%ebp)
c01036bf:	e9 bf 00 00 00       	jmp    c0103783 <idt_init+0xd1>
        SETGATE(idt[i], 0, GD_KTEXT, __vectors[i], DPL_KERNEL);
c01036c4:	8b 45 f8             	mov    -0x8(%ebp),%eax
c01036c7:	8b 55 f8             	mov    -0x8(%ebp),%edx
c01036ca:	8b 14 95 60 76 12 c0 	mov    -0x3fed89a0(,%edx,4),%edx
c01036d1:	66 89 14 c5 20 81 12 	mov    %dx,-0x3fed7ee0(,%eax,8)
c01036d8:	c0 
c01036d9:	8b 45 f8             	mov    -0x8(%ebp),%eax
c01036dc:	66 c7 04 c5 22 81 12 	movw   $0x8,-0x3fed7ede(,%eax,8)
c01036e3:	c0 08 00 
c01036e6:	8b 45 f8             	mov    -0x8(%ebp),%eax
c01036e9:	0f b6 14 c5 24 81 12 	movzbl -0x3fed7edc(,%eax,8),%edx
c01036f0:	c0 
c01036f1:	83 e2 e0             	and    $0xffffffe0,%edx
c01036f4:	88 14 c5 24 81 12 c0 	mov    %dl,-0x3fed7edc(,%eax,8)
c01036fb:	8b 45 f8             	mov    -0x8(%ebp),%eax
c01036fe:	0f b6 14 c5 24 81 12 	movzbl -0x3fed7edc(,%eax,8),%edx
c0103705:	c0 
c0103706:	83 e2 1f             	and    $0x1f,%edx
c0103709:	88 14 c5 24 81 12 c0 	mov    %dl,-0x3fed7edc(,%eax,8)
c0103710:	8b 45 f8             	mov    -0x8(%ebp),%eax
c0103713:	0f b6 14 c5 25 81 12 	movzbl -0x3fed7edb(,%eax,8),%edx
c010371a:	c0 
c010371b:	83 e2 f0             	and    $0xfffffff0,%edx
c010371e:	83 ca 0e             	or     $0xe,%edx
c0103721:	88 14 c5 25 81 12 c0 	mov    %dl,-0x3fed7edb(,%eax,8)
c0103728:	8b 45 f8             	mov    -0x8(%ebp),%eax
c010372b:	0f b6 14 c5 25 81 12 	movzbl -0x3fed7edb(,%eax,8),%edx
c0103732:	c0 
c0103733:	83 e2 ef             	and    $0xffffffef,%edx
c0103736:	88 14 c5 25 81 12 c0 	mov    %dl,-0x3fed7edb(,%eax,8)
c010373d:	8b 45 f8             	mov    -0x8(%ebp),%eax
c0103740:	0f b6 14 c5 25 81 12 	movzbl -0x3fed7edb(,%eax,8),%edx
c0103747:	c0 
c0103748:	83 e2 9f             	and    $0xffffff9f,%edx
c010374b:	88 14 c5 25 81 12 c0 	mov    %dl,-0x3fed7edb(,%eax,8)
c0103752:	8b 45 f8             	mov    -0x8(%ebp),%eax
c0103755:	0f b6 14 c5 25 81 12 	movzbl -0x3fed7edb(,%eax,8),%edx
c010375c:	c0 
c010375d:	83 ca 80             	or     $0xffffff80,%edx
c0103760:	88 14 c5 25 81 12 c0 	mov    %dl,-0x3fed7edb(,%eax,8)
c0103767:	8b 45 f8             	mov    -0x8(%ebp),%eax
c010376a:	8b 55 f8             	mov    -0x8(%ebp),%edx
c010376d:	8b 14 95 60 76 12 c0 	mov    -0x3fed89a0(,%edx,4),%edx
c0103774:	c1 ea 10             	shr    $0x10,%edx
c0103777:	66 89 14 c5 26 81 12 	mov    %dx,-0x3fed7eda(,%eax,8)
c010377e:	c0 

void
idt_init(void) {
    extern uintptr_t __vectors[];
    int i;
    for (i = 0; i < sizeof(idt) / sizeof(struct gatedesc); i ++) {
c010377f:	83 45 f8 01          	addl   $0x1,-0x8(%ebp)
c0103783:	8b 45 f8             	mov    -0x8(%ebp),%eax
c0103786:	3d ff 00 00 00       	cmp    $0xff,%eax
c010378b:	0f 86 33 ff ff ff    	jbe    c01036c4 <idt_init+0x12>
c0103791:	c7 45 fc e0 75 12 c0 	movl   $0xc01275e0,-0x4(%ebp)
    }
}

static inline void
lidt(struct pseudodesc *pd) {
    asm volatile ("lidt (%0)" :: "r" (pd));
c0103798:	8b 45 fc             	mov    -0x4(%ebp),%eax
c010379b:	0f 01 18             	lidtl  (%eax)
        SETGATE(idt[i], 0, GD_KTEXT, __vectors[i], DPL_KERNEL);
    }
    lidt(&idt_pd);
}
c010379e:	c9                   	leave  
c010379f:	c3                   	ret    

c01037a0 <trapname>:

static const char *
trapname(int trapno) {
c01037a0:	55                   	push   %ebp
c01037a1:	89 e5                	mov    %esp,%ebp
        "Alignment Check",
        "Machine-Check",
        "SIMD Floating-Point Exception"
    };

    if (trapno < sizeof(excnames)/sizeof(const char * const)) {
c01037a3:	8b 45 08             	mov    0x8(%ebp),%eax
c01037a6:	83 f8 13             	cmp    $0x13,%eax
c01037a9:	77 0c                	ja     c01037b7 <trapname+0x17>
        return excnames[trapno];
c01037ab:	8b 45 08             	mov    0x8(%ebp),%eax
c01037ae:	8b 04 85 20 bd 10 c0 	mov    -0x3fef42e0(,%eax,4),%eax
c01037b5:	eb 18                	jmp    c01037cf <trapname+0x2f>
    }
    if (trapno >= IRQ_OFFSET && trapno < IRQ_OFFSET + 16) {
c01037b7:	83 7d 08 1f          	cmpl   $0x1f,0x8(%ebp)
c01037bb:	7e 0d                	jle    c01037ca <trapname+0x2a>
c01037bd:	83 7d 08 2f          	cmpl   $0x2f,0x8(%ebp)
c01037c1:	7f 07                	jg     c01037ca <trapname+0x2a>
        return "Hardware Interrupt";
c01037c3:	b8 ff b8 10 c0       	mov    $0xc010b8ff,%eax
c01037c8:	eb 05                	jmp    c01037cf <trapname+0x2f>
    }
    return "(unknown trap)";
c01037ca:	b8 12 b9 10 c0       	mov    $0xc010b912,%eax
}
c01037cf:	5d                   	pop    %ebp
c01037d0:	c3                   	ret    

c01037d1 <trap_in_kernel>:

bool
trap_in_kernel(struct trapframe *tf) {
c01037d1:	55                   	push   %ebp
c01037d2:	89 e5                	mov    %esp,%ebp
    return (tf->tf_cs == (uint16_t)KERNEL_CS);
c01037d4:	8b 45 08             	mov    0x8(%ebp),%eax
c01037d7:	0f b7 40 34          	movzwl 0x34(%eax),%eax
c01037db:	66 83 f8 08          	cmp    $0x8,%ax
c01037df:	0f 94 c0             	sete   %al
c01037e2:	0f b6 c0             	movzbl %al,%eax
}
c01037e5:	5d                   	pop    %ebp
c01037e6:	c3                   	ret    

c01037e7 <print_trapframe>:
    "TF", "IF", "DF", "OF", NULL, NULL, "NT", NULL,
    "RF", "VM", "AC", "VIF", "VIP", "ID", NULL, NULL,
};

void
print_trapframe(struct trapframe *tf) {
c01037e7:	55                   	push   %ebp
c01037e8:	89 e5                	mov    %esp,%ebp
c01037ea:	83 ec 28             	sub    $0x28,%esp
    cprintf("trapframe at %p\n", tf);
c01037ed:	8b 45 08             	mov    0x8(%ebp),%eax
c01037f0:	89 44 24 04          	mov    %eax,0x4(%esp)
c01037f4:	c7 04 24 53 b9 10 c0 	movl   $0xc010b953,(%esp)
c01037fb:	e8 cc dd ff ff       	call   c01015cc <cprintf>
    print_regs(&tf->tf_regs);
c0103800:	8b 45 08             	mov    0x8(%ebp),%eax
c0103803:	89 04 24             	mov    %eax,(%esp)
c0103806:	e8 6d 01 00 00       	call   c0103978 <print_regs>
    cprintf("  es   0x----%04x\n", tf->tf_es);
c010380b:	8b 45 08             	mov    0x8(%ebp),%eax
c010380e:	0f b7 40 20          	movzwl 0x20(%eax),%eax
c0103812:	0f b7 c0             	movzwl %ax,%eax
c0103815:	89 44 24 04          	mov    %eax,0x4(%esp)
c0103819:	c7 04 24 64 b9 10 c0 	movl   $0xc010b964,(%esp)
c0103820:	e8 a7 dd ff ff       	call   c01015cc <cprintf>
    cprintf("  ds   0x----%04x\n", tf->tf_ds);
c0103825:	8b 45 08             	mov    0x8(%ebp),%eax
c0103828:	0f b7 40 24          	movzwl 0x24(%eax),%eax
c010382c:	0f b7 c0             	movzwl %ax,%eax
c010382f:	89 44 24 04          	mov    %eax,0x4(%esp)
c0103833:	c7 04 24 77 b9 10 c0 	movl   $0xc010b977,(%esp)
c010383a:	e8 8d dd ff ff       	call   c01015cc <cprintf>
    cprintf("  trap 0x%08x %s\n", tf->tf_trapno, trapname(tf->tf_trapno));
c010383f:	8b 45 08             	mov    0x8(%ebp),%eax
c0103842:	8b 40 28             	mov    0x28(%eax),%eax
c0103845:	89 04 24             	mov    %eax,(%esp)
c0103848:	e8 53 ff ff ff       	call   c01037a0 <trapname>
c010384d:	8b 55 08             	mov    0x8(%ebp),%edx
c0103850:	8b 52 28             	mov    0x28(%edx),%edx
c0103853:	89 44 24 08          	mov    %eax,0x8(%esp)
c0103857:	89 54 24 04          	mov    %edx,0x4(%esp)
c010385b:	c7 04 24 8a b9 10 c0 	movl   $0xc010b98a,(%esp)
c0103862:	e8 65 dd ff ff       	call   c01015cc <cprintf>
    cprintf("  err  0x%08x\n", tf->tf_err);
c0103867:	8b 45 08             	mov    0x8(%ebp),%eax
c010386a:	8b 40 2c             	mov    0x2c(%eax),%eax
c010386d:	89 44 24 04          	mov    %eax,0x4(%esp)
c0103871:	c7 04 24 9c b9 10 c0 	movl   $0xc010b99c,(%esp)
c0103878:	e8 4f dd ff ff       	call   c01015cc <cprintf>
    cprintf("  eip  0x%08x\n", tf->tf_eip);
c010387d:	8b 45 08             	mov    0x8(%ebp),%eax
c0103880:	8b 40 30             	mov    0x30(%eax),%eax
c0103883:	89 44 24 04          	mov    %eax,0x4(%esp)
c0103887:	c7 04 24 ab b9 10 c0 	movl   $0xc010b9ab,(%esp)
c010388e:	e8 39 dd ff ff       	call   c01015cc <cprintf>
    cprintf("  cs   0x----%04x\n", tf->tf_cs);
c0103893:	8b 45 08             	mov    0x8(%ebp),%eax
c0103896:	0f b7 40 34          	movzwl 0x34(%eax),%eax
c010389a:	0f b7 c0             	movzwl %ax,%eax
c010389d:	89 44 24 04          	mov    %eax,0x4(%esp)
c01038a1:	c7 04 24 ba b9 10 c0 	movl   $0xc010b9ba,(%esp)
c01038a8:	e8 1f dd ff ff       	call   c01015cc <cprintf>
    cprintf("  flag 0x%08x ", tf->tf_eflags);
c01038ad:	8b 45 08             	mov    0x8(%ebp),%eax
c01038b0:	8b 40 38             	mov    0x38(%eax),%eax
c01038b3:	89 44 24 04          	mov    %eax,0x4(%esp)
c01038b7:	c7 04 24 cd b9 10 c0 	movl   $0xc010b9cd,(%esp)
c01038be:	e8 09 dd ff ff       	call   c01015cc <cprintf>

    int i, j;
    for (i = 0, j = 1; i < sizeof(IA32flags) / sizeof(IA32flags[0]); i ++, j <<= 1) {
c01038c3:	c7 45 f0 00 00 00 00 	movl   $0x0,-0x10(%ebp)
c01038ca:	c7 45 f4 01 00 00 00 	movl   $0x1,-0xc(%ebp)
c01038d1:	eb 3e                	jmp    c0103911 <print_trapframe+0x12a>
        if ((tf->tf_eflags & j) && IA32flags[i] != NULL) {
c01038d3:	8b 45 08             	mov    0x8(%ebp),%eax
c01038d6:	8b 50 38             	mov    0x38(%eax),%edx
c01038d9:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01038dc:	21 d0                	and    %edx,%eax
c01038de:	85 c0                	test   %eax,%eax
c01038e0:	74 28                	je     c010390a <print_trapframe+0x123>
c01038e2:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01038e5:	8b 04 85 00 76 12 c0 	mov    -0x3fed8a00(,%eax,4),%eax
c01038ec:	85 c0                	test   %eax,%eax
c01038ee:	74 1a                	je     c010390a <print_trapframe+0x123>
            cprintf("%s,", IA32flags[i]);
c01038f0:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01038f3:	8b 04 85 00 76 12 c0 	mov    -0x3fed8a00(,%eax,4),%eax
c01038fa:	89 44 24 04          	mov    %eax,0x4(%esp)
c01038fe:	c7 04 24 dc b9 10 c0 	movl   $0xc010b9dc,(%esp)
c0103905:	e8 c2 dc ff ff       	call   c01015cc <cprintf>
    cprintf("  eip  0x%08x\n", tf->tf_eip);
    cprintf("  cs   0x----%04x\n", tf->tf_cs);
    cprintf("  flag 0x%08x ", tf->tf_eflags);

    int i, j;
    for (i = 0, j = 1; i < sizeof(IA32flags) / sizeof(IA32flags[0]); i ++, j <<= 1) {
c010390a:	83 45 f0 01          	addl   $0x1,-0x10(%ebp)
c010390e:	d1 65 f4             	shll   -0xc(%ebp)
c0103911:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0103914:	83 f8 17             	cmp    $0x17,%eax
c0103917:	76 ba                	jbe    c01038d3 <print_trapframe+0xec>
        if ((tf->tf_eflags & j) && IA32flags[i] != NULL) {
            cprintf("%s,", IA32flags[i]);
        }
    }
    cprintf("IOPL=%d\n", (tf->tf_eflags & FL_IOPL_MASK) >> 12);
c0103919:	8b 45 08             	mov    0x8(%ebp),%eax
c010391c:	8b 40 38             	mov    0x38(%eax),%eax
c010391f:	25 00 30 00 00       	and    $0x3000,%eax
c0103924:	c1 e8 0c             	shr    $0xc,%eax
c0103927:	89 44 24 04          	mov    %eax,0x4(%esp)
c010392b:	c7 04 24 e0 b9 10 c0 	movl   $0xc010b9e0,(%esp)
c0103932:	e8 95 dc ff ff       	call   c01015cc <cprintf>

    if (!trap_in_kernel(tf)) {
c0103937:	8b 45 08             	mov    0x8(%ebp),%eax
c010393a:	89 04 24             	mov    %eax,(%esp)
c010393d:	e8 8f fe ff ff       	call   c01037d1 <trap_in_kernel>
c0103942:	85 c0                	test   %eax,%eax
c0103944:	75 30                	jne    c0103976 <print_trapframe+0x18f>
        cprintf("  esp  0x%08x\n", tf->tf_esp);
c0103946:	8b 45 08             	mov    0x8(%ebp),%eax
c0103949:	8b 40 3c             	mov    0x3c(%eax),%eax
c010394c:	89 44 24 04          	mov    %eax,0x4(%esp)
c0103950:	c7 04 24 e9 b9 10 c0 	movl   $0xc010b9e9,(%esp)
c0103957:	e8 70 dc ff ff       	call   c01015cc <cprintf>
        cprintf("  ss   0x----%04x\n", tf->tf_ss);
c010395c:	8b 45 08             	mov    0x8(%ebp),%eax
c010395f:	0f b7 40 40          	movzwl 0x40(%eax),%eax
c0103963:	0f b7 c0             	movzwl %ax,%eax
c0103966:	89 44 24 04          	mov    %eax,0x4(%esp)
c010396a:	c7 04 24 f8 b9 10 c0 	movl   $0xc010b9f8,(%esp)
c0103971:	e8 56 dc ff ff       	call   c01015cc <cprintf>
    }
}
c0103976:	c9                   	leave  
c0103977:	c3                   	ret    

c0103978 <print_regs>:

void
print_regs(struct pushregs *regs) {
c0103978:	55                   	push   %ebp
c0103979:	89 e5                	mov    %esp,%ebp
c010397b:	83 ec 18             	sub    $0x18,%esp
    cprintf("  edi  0x%08x\n", regs->reg_edi);
c010397e:	8b 45 08             	mov    0x8(%ebp),%eax
c0103981:	8b 00                	mov    (%eax),%eax
c0103983:	89 44 24 04          	mov    %eax,0x4(%esp)
c0103987:	c7 04 24 0b ba 10 c0 	movl   $0xc010ba0b,(%esp)
c010398e:	e8 39 dc ff ff       	call   c01015cc <cprintf>
    cprintf("  esi  0x%08x\n", regs->reg_esi);
c0103993:	8b 45 08             	mov    0x8(%ebp),%eax
c0103996:	8b 40 04             	mov    0x4(%eax),%eax
c0103999:	89 44 24 04          	mov    %eax,0x4(%esp)
c010399d:	c7 04 24 1a ba 10 c0 	movl   $0xc010ba1a,(%esp)
c01039a4:	e8 23 dc ff ff       	call   c01015cc <cprintf>
    cprintf("  ebp  0x%08x\n", regs->reg_ebp);
c01039a9:	8b 45 08             	mov    0x8(%ebp),%eax
c01039ac:	8b 40 08             	mov    0x8(%eax),%eax
c01039af:	89 44 24 04          	mov    %eax,0x4(%esp)
c01039b3:	c7 04 24 29 ba 10 c0 	movl   $0xc010ba29,(%esp)
c01039ba:	e8 0d dc ff ff       	call   c01015cc <cprintf>
    cprintf("  oesp 0x%08x\n", regs->reg_oesp);
c01039bf:	8b 45 08             	mov    0x8(%ebp),%eax
c01039c2:	8b 40 0c             	mov    0xc(%eax),%eax
c01039c5:	89 44 24 04          	mov    %eax,0x4(%esp)
c01039c9:	c7 04 24 38 ba 10 c0 	movl   $0xc010ba38,(%esp)
c01039d0:	e8 f7 db ff ff       	call   c01015cc <cprintf>
    cprintf("  ebx  0x%08x\n", regs->reg_ebx);
c01039d5:	8b 45 08             	mov    0x8(%ebp),%eax
c01039d8:	8b 40 10             	mov    0x10(%eax),%eax
c01039db:	89 44 24 04          	mov    %eax,0x4(%esp)
c01039df:	c7 04 24 47 ba 10 c0 	movl   $0xc010ba47,(%esp)
c01039e6:	e8 e1 db ff ff       	call   c01015cc <cprintf>
    cprintf("  edx  0x%08x\n", regs->reg_edx);
c01039eb:	8b 45 08             	mov    0x8(%ebp),%eax
c01039ee:	8b 40 14             	mov    0x14(%eax),%eax
c01039f1:	89 44 24 04          	mov    %eax,0x4(%esp)
c01039f5:	c7 04 24 56 ba 10 c0 	movl   $0xc010ba56,(%esp)
c01039fc:	e8 cb db ff ff       	call   c01015cc <cprintf>
    cprintf("  ecx  0x%08x\n", regs->reg_ecx);
c0103a01:	8b 45 08             	mov    0x8(%ebp),%eax
c0103a04:	8b 40 18             	mov    0x18(%eax),%eax
c0103a07:	89 44 24 04          	mov    %eax,0x4(%esp)
c0103a0b:	c7 04 24 65 ba 10 c0 	movl   $0xc010ba65,(%esp)
c0103a12:	e8 b5 db ff ff       	call   c01015cc <cprintf>
    cprintf("  eax  0x%08x\n", regs->reg_eax);
c0103a17:	8b 45 08             	mov    0x8(%ebp),%eax
c0103a1a:	8b 40 1c             	mov    0x1c(%eax),%eax
c0103a1d:	89 44 24 04          	mov    %eax,0x4(%esp)
c0103a21:	c7 04 24 74 ba 10 c0 	movl   $0xc010ba74,(%esp)
c0103a28:	e8 9f db ff ff       	call   c01015cc <cprintf>
}
c0103a2d:	c9                   	leave  
c0103a2e:	c3                   	ret    

c0103a2f <print_pgfault>:

static inline void
print_pgfault(struct trapframe *tf) {
c0103a2f:	55                   	push   %ebp
c0103a30:	89 e5                	mov    %esp,%ebp
c0103a32:	53                   	push   %ebx
c0103a33:	83 ec 34             	sub    $0x34,%esp
     * bit 2 == 0 means kernel, 1 means user
     * */
    cprintf("page fault at 0x%08x: %c/%c [%s].\n", rcr2(),
            (tf->tf_err & 4) ? 'U' : 'K',
            (tf->tf_err & 2) ? 'W' : 'R',
            (tf->tf_err & 1) ? "protection fault" : "no page found");
c0103a36:	8b 45 08             	mov    0x8(%ebp),%eax
c0103a39:	8b 40 2c             	mov    0x2c(%eax),%eax
c0103a3c:	83 e0 01             	and    $0x1,%eax
    /* error_code:
     * bit 0 == 0 means no page found, 1 means protection fault
     * bit 1 == 0 means read, 1 means write
     * bit 2 == 0 means kernel, 1 means user
     * */
    cprintf("page fault at 0x%08x: %c/%c [%s].\n", rcr2(),
c0103a3f:	84 c0                	test   %al,%al
c0103a41:	74 07                	je     c0103a4a <print_pgfault+0x1b>
c0103a43:	b9 83 ba 10 c0       	mov    $0xc010ba83,%ecx
c0103a48:	eb 05                	jmp    c0103a4f <print_pgfault+0x20>
c0103a4a:	b9 94 ba 10 c0       	mov    $0xc010ba94,%ecx
            (tf->tf_err & 4) ? 'U' : 'K',
            (tf->tf_err & 2) ? 'W' : 'R',
c0103a4f:	8b 45 08             	mov    0x8(%ebp),%eax
c0103a52:	8b 40 2c             	mov    0x2c(%eax),%eax
c0103a55:	83 e0 02             	and    $0x2,%eax
    /* error_code:
     * bit 0 == 0 means no page found, 1 means protection fault
     * bit 1 == 0 means read, 1 means write
     * bit 2 == 0 means kernel, 1 means user
     * */
    cprintf("page fault at 0x%08x: %c/%c [%s].\n", rcr2(),
c0103a58:	85 c0                	test   %eax,%eax
c0103a5a:	74 07                	je     c0103a63 <print_pgfault+0x34>
c0103a5c:	ba 57 00 00 00       	mov    $0x57,%edx
c0103a61:	eb 05                	jmp    c0103a68 <print_pgfault+0x39>
c0103a63:	ba 52 00 00 00       	mov    $0x52,%edx
            (tf->tf_err & 4) ? 'U' : 'K',
c0103a68:	8b 45 08             	mov    0x8(%ebp),%eax
c0103a6b:	8b 40 2c             	mov    0x2c(%eax),%eax
c0103a6e:	83 e0 04             	and    $0x4,%eax
    /* error_code:
     * bit 0 == 0 means no page found, 1 means protection fault
     * bit 1 == 0 means read, 1 means write
     * bit 2 == 0 means kernel, 1 means user
     * */
    cprintf("page fault at 0x%08x: %c/%c [%s].\n", rcr2(),
c0103a71:	85 c0                	test   %eax,%eax
c0103a73:	74 07                	je     c0103a7c <print_pgfault+0x4d>
c0103a75:	b8 55 00 00 00       	mov    $0x55,%eax
c0103a7a:	eb 05                	jmp    c0103a81 <print_pgfault+0x52>
c0103a7c:	b8 4b 00 00 00       	mov    $0x4b,%eax
}

static inline uintptr_t
rcr2(void) {
    uintptr_t cr2;
    asm volatile ("mov %%cr2, %0" : "=r" (cr2));
c0103a81:	0f 20 d3             	mov    %cr2,%ebx
c0103a84:	89 5d f4             	mov    %ebx,-0xc(%ebp)
    return cr2;
c0103a87:	8b 5d f4             	mov    -0xc(%ebp),%ebx
c0103a8a:	89 4c 24 10          	mov    %ecx,0x10(%esp)
c0103a8e:	89 54 24 0c          	mov    %edx,0xc(%esp)
c0103a92:	89 44 24 08          	mov    %eax,0x8(%esp)
c0103a96:	89 5c 24 04          	mov    %ebx,0x4(%esp)
c0103a9a:	c7 04 24 a4 ba 10 c0 	movl   $0xc010baa4,(%esp)
c0103aa1:	e8 26 db ff ff       	call   c01015cc <cprintf>
            (tf->tf_err & 4) ? 'U' : 'K',
            (tf->tf_err & 2) ? 'W' : 'R',
            (tf->tf_err & 1) ? "protection fault" : "no page found");
}
c0103aa6:	83 c4 34             	add    $0x34,%esp
c0103aa9:	5b                   	pop    %ebx
c0103aaa:	5d                   	pop    %ebp
c0103aab:	c3                   	ret    

c0103aac <pgfault_handler>:

static int
pgfault_handler(struct trapframe *tf) {
c0103aac:	55                   	push   %ebp
c0103aad:	89 e5                	mov    %esp,%ebp
c0103aaf:	83 ec 28             	sub    $0x28,%esp
    extern struct mm_struct *check_mm_struct;
    print_pgfault(tf);
c0103ab2:	8b 45 08             	mov    0x8(%ebp),%eax
c0103ab5:	89 04 24             	mov    %eax,(%esp)
c0103ab8:	e8 72 ff ff ff       	call   c0103a2f <print_pgfault>
    if (check_mm_struct != NULL) {
c0103abd:	a1 b8 8c 12 c0       	mov    0xc0128cb8,%eax
c0103ac2:	85 c0                	test   %eax,%eax
c0103ac4:	74 28                	je     c0103aee <pgfault_handler+0x42>
}

static inline uintptr_t
rcr2(void) {
    uintptr_t cr2;
    asm volatile ("mov %%cr2, %0" : "=r" (cr2));
c0103ac6:	0f 20 d0             	mov    %cr2,%eax
c0103ac9:	89 45 f4             	mov    %eax,-0xc(%ebp)
    return cr2;
c0103acc:	8b 45 f4             	mov    -0xc(%ebp),%eax
        return do_pgfault(check_mm_struct, tf->tf_err, rcr2());
c0103acf:	89 c1                	mov    %eax,%ecx
c0103ad1:	8b 45 08             	mov    0x8(%ebp),%eax
c0103ad4:	8b 50 2c             	mov    0x2c(%eax),%edx
c0103ad7:	a1 b8 8c 12 c0       	mov    0xc0128cb8,%eax
c0103adc:	89 4c 24 08          	mov    %ecx,0x8(%esp)
c0103ae0:	89 54 24 04          	mov    %edx,0x4(%esp)
c0103ae4:	89 04 24             	mov    %eax,(%esp)
c0103ae7:	e8 e0 65 00 00       	call   c010a0cc <do_pgfault>
    }
    panic("unhandled page fault.\n");
}
c0103aec:	c9                   	leave  
c0103aed:	c3                   	ret    
    extern struct mm_struct *check_mm_struct;
    print_pgfault(tf);
    if (check_mm_struct != NULL) {
        return do_pgfault(check_mm_struct, tf->tf_err, rcr2());
    }
    panic("unhandled page fault.\n");
c0103aee:	c7 44 24 08 c7 ba 10 	movl   $0xc010bac7,0x8(%esp)
c0103af5:	c0 
c0103af6:	c7 44 24 04 8e 00 00 	movl   $0x8e,0x4(%esp)
c0103afd:	00 
c0103afe:	c7 04 24 ee b8 10 c0 	movl   $0xc010b8ee,(%esp)
c0103b05:	e8 a6 ef ff ff       	call   c0102ab0 <__panic>

c0103b0a <trap_dispatch>:
}

static void
trap_dispatch(struct trapframe *tf) {
c0103b0a:	55                   	push   %ebp
c0103b0b:	89 e5                	mov    %esp,%ebp
c0103b0d:	83 ec 28             	sub    $0x28,%esp
    char c;

    int ret;

    switch (tf->tf_trapno) {
c0103b10:	8b 45 08             	mov    0x8(%ebp),%eax
c0103b13:	8b 40 28             	mov    0x28(%eax),%eax
c0103b16:	83 f8 24             	cmp    $0x24,%eax
c0103b19:	0f 87 ef 00 00 00    	ja     c0103c0e <trap_dispatch+0x104>
c0103b1f:	8b 04 85 30 bb 10 c0 	mov    -0x3fef44d0(,%eax,4),%eax
c0103b26:	ff e0                	jmp    *%eax
    case T_DEBUG:
    case T_BRKPT:
        debug_monitor(tf);
c0103b28:	8b 45 08             	mov    0x8(%ebp),%eax
c0103b2b:	89 04 24             	mov    %eax,(%esp)
c0103b2e:	e8 8b e7 ff ff       	call   c01022be <debug_monitor>
        break;
c0103b33:	e9 12 01 00 00       	jmp    c0103c4a <trap_dispatch+0x140>
    case T_PGFLT:
        if ((ret = pgfault_handler(tf)) != 0) {
c0103b38:	8b 45 08             	mov    0x8(%ebp),%eax
c0103b3b:	89 04 24             	mov    %eax,(%esp)
c0103b3e:	e8 69 ff ff ff       	call   c0103aac <pgfault_handler>
c0103b43:	89 45 f4             	mov    %eax,-0xc(%ebp)
c0103b46:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c0103b4a:	0f 84 f6 00 00 00    	je     c0103c46 <trap_dispatch+0x13c>
            print_trapframe(tf);
c0103b50:	8b 45 08             	mov    0x8(%ebp),%eax
c0103b53:	89 04 24             	mov    %eax,(%esp)
c0103b56:	e8 8c fc ff ff       	call   c01037e7 <print_trapframe>
            panic("handle pgfault failed. %e\n", ret);
c0103b5b:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0103b5e:	89 44 24 0c          	mov    %eax,0xc(%esp)
c0103b62:	c7 44 24 08 de ba 10 	movl   $0xc010bade,0x8(%esp)
c0103b69:	c0 
c0103b6a:	c7 44 24 04 9f 00 00 	movl   $0x9f,0x4(%esp)
c0103b71:	00 
c0103b72:	c7 04 24 ee b8 10 c0 	movl   $0xc010b8ee,(%esp)
c0103b79:	e8 32 ef ff ff       	call   c0102ab0 <__panic>
        }
        break;
    case IRQ_OFFSET + IRQ_TIMER:
        ticks ++;
c0103b7e:	a1 a8 8c 12 c0       	mov    0xc0128ca8,%eax
c0103b83:	83 c0 01             	add    $0x1,%eax
c0103b86:	a3 a8 8c 12 c0       	mov    %eax,0xc0128ca8
        if (ticks % TICK_NUM == 0) {
c0103b8b:	8b 0d a8 8c 12 c0    	mov    0xc0128ca8,%ecx
c0103b91:	ba 1f 85 eb 51       	mov    $0x51eb851f,%edx
c0103b96:	89 c8                	mov    %ecx,%eax
c0103b98:	f7 e2                	mul    %edx
c0103b9a:	89 d0                	mov    %edx,%eax
c0103b9c:	c1 e8 05             	shr    $0x5,%eax
c0103b9f:	6b c0 64             	imul   $0x64,%eax,%eax
c0103ba2:	89 ca                	mov    %ecx,%edx
c0103ba4:	29 c2                	sub    %eax,%edx
c0103ba6:	89 d0                	mov    %edx,%eax
c0103ba8:	85 c0                	test   %eax,%eax
c0103baa:	0f 85 99 00 00 00    	jne    c0103c49 <trap_dispatch+0x13f>
            print_ticks();
c0103bb0:	e8 bb fa ff ff       	call   c0103670 <print_ticks>
        }
        break;
c0103bb5:	e9 90 00 00 00       	jmp    c0103c4a <trap_dispatch+0x140>
    case IRQ_OFFSET + IRQ_COM1:
    case IRQ_OFFSET + IRQ_KBD:
        if ((c = cons_getc()) == 13) {
c0103bba:	e8 6c f8 ff ff       	call   c010342b <cons_getc>
c0103bbf:	88 45 f3             	mov    %al,-0xd(%ebp)
c0103bc2:	80 7d f3 0d          	cmpb   $0xd,-0xd(%ebp)
c0103bc6:	75 0d                	jne    c0103bd5 <trap_dispatch+0xcb>
            debug_monitor(tf);
c0103bc8:	8b 45 08             	mov    0x8(%ebp),%eax
c0103bcb:	89 04 24             	mov    %eax,(%esp)
c0103bce:	e8 eb e6 ff ff       	call   c01022be <debug_monitor>
        }
        else {
            cprintf("%s [%03d] %c\n",
                    (tf->tf_trapno != IRQ_OFFSET + IRQ_KBD) ? "serial" : "kbd", c, c);
        }
        break;
c0103bd3:	eb 75                	jmp    c0103c4a <trap_dispatch+0x140>
    case IRQ_OFFSET + IRQ_KBD:
        if ((c = cons_getc()) == 13) {
            debug_monitor(tf);
        }
        else {
            cprintf("%s [%03d] %c\n",
c0103bd5:	0f be 4d f3          	movsbl -0xd(%ebp),%ecx
c0103bd9:	0f be 55 f3          	movsbl -0xd(%ebp),%edx
                    (tf->tf_trapno != IRQ_OFFSET + IRQ_KBD) ? "serial" : "kbd", c, c);
c0103bdd:	8b 45 08             	mov    0x8(%ebp),%eax
c0103be0:	8b 40 28             	mov    0x28(%eax),%eax
    case IRQ_OFFSET + IRQ_KBD:
        if ((c = cons_getc()) == 13) {
            debug_monitor(tf);
        }
        else {
            cprintf("%s [%03d] %c\n",
c0103be3:	83 f8 21             	cmp    $0x21,%eax
c0103be6:	74 07                	je     c0103bef <trap_dispatch+0xe5>
c0103be8:	b8 f9 ba 10 c0       	mov    $0xc010baf9,%eax
c0103bed:	eb 05                	jmp    c0103bf4 <trap_dispatch+0xea>
c0103bef:	b8 00 bb 10 c0       	mov    $0xc010bb00,%eax
c0103bf4:	89 4c 24 0c          	mov    %ecx,0xc(%esp)
c0103bf8:	89 54 24 08          	mov    %edx,0x8(%esp)
c0103bfc:	89 44 24 04          	mov    %eax,0x4(%esp)
c0103c00:	c7 04 24 04 bb 10 c0 	movl   $0xc010bb04,(%esp)
c0103c07:	e8 c0 d9 ff ff       	call   c01015cc <cprintf>
                    (tf->tf_trapno != IRQ_OFFSET + IRQ_KBD) ? "serial" : "kbd", c, c);
        }
        break;
c0103c0c:	eb 3c                	jmp    c0103c4a <trap_dispatch+0x140>
    default:
        // in kernel, it must be a mistake
        if ((tf->tf_cs & 3) == 0) {
c0103c0e:	8b 45 08             	mov    0x8(%ebp),%eax
c0103c11:	0f b7 40 34          	movzwl 0x34(%eax),%eax
c0103c15:	0f b7 c0             	movzwl %ax,%eax
c0103c18:	83 e0 03             	and    $0x3,%eax
c0103c1b:	85 c0                	test   %eax,%eax
c0103c1d:	75 2b                	jne    c0103c4a <trap_dispatch+0x140>
            print_trapframe(tf);
c0103c1f:	8b 45 08             	mov    0x8(%ebp),%eax
c0103c22:	89 04 24             	mov    %eax,(%esp)
c0103c25:	e8 bd fb ff ff       	call   c01037e7 <print_trapframe>
            panic("unexpected trap in kernel.\n");
c0103c2a:	c7 44 24 08 12 bb 10 	movl   $0xc010bb12,0x8(%esp)
c0103c31:	c0 
c0103c32:	c7 44 24 04 b6 00 00 	movl   $0xb6,0x4(%esp)
c0103c39:	00 
c0103c3a:	c7 04 24 ee b8 10 c0 	movl   $0xc010b8ee,(%esp)
c0103c41:	e8 6a ee ff ff       	call   c0102ab0 <__panic>
    case T_PGFLT:
        if ((ret = pgfault_handler(tf)) != 0) {
            print_trapframe(tf);
            panic("handle pgfault failed. %e\n", ret);
        }
        break;
c0103c46:	90                   	nop
c0103c47:	eb 01                	jmp    c0103c4a <trap_dispatch+0x140>
    case IRQ_OFFSET + IRQ_TIMER:
        ticks ++;
        if (ticks % TICK_NUM == 0) {
            print_ticks();
        }
        break;
c0103c49:	90                   	nop
        if ((tf->tf_cs & 3) == 0) {
            print_trapframe(tf);
            panic("unexpected trap in kernel.\n");
        }
    }
}
c0103c4a:	c9                   	leave  
c0103c4b:	c3                   	ret    

c0103c4c <trap>:

void
trap(struct trapframe *tf) {
c0103c4c:	55                   	push   %ebp
c0103c4d:	89 e5                	mov    %esp,%ebp
c0103c4f:	83 ec 18             	sub    $0x18,%esp
    // dispatch based on what type of trap occurred
    trap_dispatch(tf);
c0103c52:	8b 45 08             	mov    0x8(%ebp),%eax
c0103c55:	89 04 24             	mov    %eax,(%esp)
c0103c58:	e8 ad fe ff ff       	call   c0103b0a <trap_dispatch>
}
c0103c5d:	c9                   	leave  
c0103c5e:	c3                   	ret    
	...

c0103c60 <__alltraps>:
.text
.globl __alltraps
__alltraps:
    # push registers to build a trap frame
    # therefore make the stack look like a struct trapframe
    pushl %ds
c0103c60:	1e                   	push   %ds
    pushl %es
c0103c61:	06                   	push   %es
    pushal
c0103c62:	60                   	pusha  

    # load GD_KDATA into %ds and %es to set up data segments for kernel
    movl $GD_KDATA, %eax
c0103c63:	b8 10 00 00 00       	mov    $0x10,%eax
    movw %ax, %ds
c0103c68:	8e d8                	mov    %eax,%ds
    movw %ax, %es
c0103c6a:	8e c0                	mov    %eax,%es

    # push %esp to pass a pointer to the trapframe as an argument to trap()
    pushl %esp
c0103c6c:	54                   	push   %esp

    # call trap(tf), where tf=%esp
    call trap
c0103c6d:	e8 da ff ff ff       	call   c0103c4c <trap>

    # pop the pushed stack pointer
    popl %esp
c0103c72:	5c                   	pop    %esp

c0103c73 <__trapret>:

    # return falls through to trapret...
.globl __trapret
__trapret:
    # restore registers from stack
    popal
c0103c73:	61                   	popa   

    # restore %ds and %es
    popl %es
c0103c74:	07                   	pop    %es
    popl %ds
c0103c75:	1f                   	pop    %ds

    # get rid of the trap number and error code
    addl $0x8, %esp
c0103c76:	83 c4 08             	add    $0x8,%esp
    iret
c0103c79:	cf                   	iret   
	...

c0103c7c <vector0>:
# handler
.text
.globl __alltraps
.globl vector0
vector0:
  pushl $0
c0103c7c:	6a 00                	push   $0x0
  pushl $0
c0103c7e:	6a 00                	push   $0x0
  jmp __alltraps
c0103c80:	e9 db ff ff ff       	jmp    c0103c60 <__alltraps>

c0103c85 <vector1>:
.globl vector1
vector1:
  pushl $0
c0103c85:	6a 00                	push   $0x0
  pushl $1
c0103c87:	6a 01                	push   $0x1
  jmp __alltraps
c0103c89:	e9 d2 ff ff ff       	jmp    c0103c60 <__alltraps>

c0103c8e <vector2>:
.globl vector2
vector2:
  pushl $0
c0103c8e:	6a 00                	push   $0x0
  pushl $2
c0103c90:	6a 02                	push   $0x2
  jmp __alltraps
c0103c92:	e9 c9 ff ff ff       	jmp    c0103c60 <__alltraps>

c0103c97 <vector3>:
.globl vector3
vector3:
  pushl $0
c0103c97:	6a 00                	push   $0x0
  pushl $3
c0103c99:	6a 03                	push   $0x3
  jmp __alltraps
c0103c9b:	e9 c0 ff ff ff       	jmp    c0103c60 <__alltraps>

c0103ca0 <vector4>:
.globl vector4
vector4:
  pushl $0
c0103ca0:	6a 00                	push   $0x0
  pushl $4
c0103ca2:	6a 04                	push   $0x4
  jmp __alltraps
c0103ca4:	e9 b7 ff ff ff       	jmp    c0103c60 <__alltraps>

c0103ca9 <vector5>:
.globl vector5
vector5:
  pushl $0
c0103ca9:	6a 00                	push   $0x0
  pushl $5
c0103cab:	6a 05                	push   $0x5
  jmp __alltraps
c0103cad:	e9 ae ff ff ff       	jmp    c0103c60 <__alltraps>

c0103cb2 <vector6>:
.globl vector6
vector6:
  pushl $0
c0103cb2:	6a 00                	push   $0x0
  pushl $6
c0103cb4:	6a 06                	push   $0x6
  jmp __alltraps
c0103cb6:	e9 a5 ff ff ff       	jmp    c0103c60 <__alltraps>

c0103cbb <vector7>:
.globl vector7
vector7:
  pushl $0
c0103cbb:	6a 00                	push   $0x0
  pushl $7
c0103cbd:	6a 07                	push   $0x7
  jmp __alltraps
c0103cbf:	e9 9c ff ff ff       	jmp    c0103c60 <__alltraps>

c0103cc4 <vector8>:
.globl vector8
vector8:
  pushl $8
c0103cc4:	6a 08                	push   $0x8
  jmp __alltraps
c0103cc6:	e9 95 ff ff ff       	jmp    c0103c60 <__alltraps>

c0103ccb <vector9>:
.globl vector9
vector9:
  pushl $9
c0103ccb:	6a 09                	push   $0x9
  jmp __alltraps
c0103ccd:	e9 8e ff ff ff       	jmp    c0103c60 <__alltraps>

c0103cd2 <vector10>:
.globl vector10
vector10:
  pushl $10
c0103cd2:	6a 0a                	push   $0xa
  jmp __alltraps
c0103cd4:	e9 87 ff ff ff       	jmp    c0103c60 <__alltraps>

c0103cd9 <vector11>:
.globl vector11
vector11:
  pushl $11
c0103cd9:	6a 0b                	push   $0xb
  jmp __alltraps
c0103cdb:	e9 80 ff ff ff       	jmp    c0103c60 <__alltraps>

c0103ce0 <vector12>:
.globl vector12
vector12:
  pushl $12
c0103ce0:	6a 0c                	push   $0xc
  jmp __alltraps
c0103ce2:	e9 79 ff ff ff       	jmp    c0103c60 <__alltraps>

c0103ce7 <vector13>:
.globl vector13
vector13:
  pushl $13
c0103ce7:	6a 0d                	push   $0xd
  jmp __alltraps
c0103ce9:	e9 72 ff ff ff       	jmp    c0103c60 <__alltraps>

c0103cee <vector14>:
.globl vector14
vector14:
  pushl $14
c0103cee:	6a 0e                	push   $0xe
  jmp __alltraps
c0103cf0:	e9 6b ff ff ff       	jmp    c0103c60 <__alltraps>

c0103cf5 <vector15>:
.globl vector15
vector15:
  pushl $0
c0103cf5:	6a 00                	push   $0x0
  pushl $15
c0103cf7:	6a 0f                	push   $0xf
  jmp __alltraps
c0103cf9:	e9 62 ff ff ff       	jmp    c0103c60 <__alltraps>

c0103cfe <vector16>:
.globl vector16
vector16:
  pushl $0
c0103cfe:	6a 00                	push   $0x0
  pushl $16
c0103d00:	6a 10                	push   $0x10
  jmp __alltraps
c0103d02:	e9 59 ff ff ff       	jmp    c0103c60 <__alltraps>

c0103d07 <vector17>:
.globl vector17
vector17:
  pushl $17
c0103d07:	6a 11                	push   $0x11
  jmp __alltraps
c0103d09:	e9 52 ff ff ff       	jmp    c0103c60 <__alltraps>

c0103d0e <vector18>:
.globl vector18
vector18:
  pushl $0
c0103d0e:	6a 00                	push   $0x0
  pushl $18
c0103d10:	6a 12                	push   $0x12
  jmp __alltraps
c0103d12:	e9 49 ff ff ff       	jmp    c0103c60 <__alltraps>

c0103d17 <vector19>:
.globl vector19
vector19:
  pushl $0
c0103d17:	6a 00                	push   $0x0
  pushl $19
c0103d19:	6a 13                	push   $0x13
  jmp __alltraps
c0103d1b:	e9 40 ff ff ff       	jmp    c0103c60 <__alltraps>

c0103d20 <vector20>:
.globl vector20
vector20:
  pushl $0
c0103d20:	6a 00                	push   $0x0
  pushl $20
c0103d22:	6a 14                	push   $0x14
  jmp __alltraps
c0103d24:	e9 37 ff ff ff       	jmp    c0103c60 <__alltraps>

c0103d29 <vector21>:
.globl vector21
vector21:
  pushl $0
c0103d29:	6a 00                	push   $0x0
  pushl $21
c0103d2b:	6a 15                	push   $0x15
  jmp __alltraps
c0103d2d:	e9 2e ff ff ff       	jmp    c0103c60 <__alltraps>

c0103d32 <vector22>:
.globl vector22
vector22:
  pushl $0
c0103d32:	6a 00                	push   $0x0
  pushl $22
c0103d34:	6a 16                	push   $0x16
  jmp __alltraps
c0103d36:	e9 25 ff ff ff       	jmp    c0103c60 <__alltraps>

c0103d3b <vector23>:
.globl vector23
vector23:
  pushl $0
c0103d3b:	6a 00                	push   $0x0
  pushl $23
c0103d3d:	6a 17                	push   $0x17
  jmp __alltraps
c0103d3f:	e9 1c ff ff ff       	jmp    c0103c60 <__alltraps>

c0103d44 <vector24>:
.globl vector24
vector24:
  pushl $0
c0103d44:	6a 00                	push   $0x0
  pushl $24
c0103d46:	6a 18                	push   $0x18
  jmp __alltraps
c0103d48:	e9 13 ff ff ff       	jmp    c0103c60 <__alltraps>

c0103d4d <vector25>:
.globl vector25
vector25:
  pushl $0
c0103d4d:	6a 00                	push   $0x0
  pushl $25
c0103d4f:	6a 19                	push   $0x19
  jmp __alltraps
c0103d51:	e9 0a ff ff ff       	jmp    c0103c60 <__alltraps>

c0103d56 <vector26>:
.globl vector26
vector26:
  pushl $0
c0103d56:	6a 00                	push   $0x0
  pushl $26
c0103d58:	6a 1a                	push   $0x1a
  jmp __alltraps
c0103d5a:	e9 01 ff ff ff       	jmp    c0103c60 <__alltraps>

c0103d5f <vector27>:
.globl vector27
vector27:
  pushl $0
c0103d5f:	6a 00                	push   $0x0
  pushl $27
c0103d61:	6a 1b                	push   $0x1b
  jmp __alltraps
c0103d63:	e9 f8 fe ff ff       	jmp    c0103c60 <__alltraps>

c0103d68 <vector28>:
.globl vector28
vector28:
  pushl $0
c0103d68:	6a 00                	push   $0x0
  pushl $28
c0103d6a:	6a 1c                	push   $0x1c
  jmp __alltraps
c0103d6c:	e9 ef fe ff ff       	jmp    c0103c60 <__alltraps>

c0103d71 <vector29>:
.globl vector29
vector29:
  pushl $0
c0103d71:	6a 00                	push   $0x0
  pushl $29
c0103d73:	6a 1d                	push   $0x1d
  jmp __alltraps
c0103d75:	e9 e6 fe ff ff       	jmp    c0103c60 <__alltraps>

c0103d7a <vector30>:
.globl vector30
vector30:
  pushl $0
c0103d7a:	6a 00                	push   $0x0
  pushl $30
c0103d7c:	6a 1e                	push   $0x1e
  jmp __alltraps
c0103d7e:	e9 dd fe ff ff       	jmp    c0103c60 <__alltraps>

c0103d83 <vector31>:
.globl vector31
vector31:
  pushl $0
c0103d83:	6a 00                	push   $0x0
  pushl $31
c0103d85:	6a 1f                	push   $0x1f
  jmp __alltraps
c0103d87:	e9 d4 fe ff ff       	jmp    c0103c60 <__alltraps>

c0103d8c <vector32>:
.globl vector32
vector32:
  pushl $0
c0103d8c:	6a 00                	push   $0x0
  pushl $32
c0103d8e:	6a 20                	push   $0x20
  jmp __alltraps
c0103d90:	e9 cb fe ff ff       	jmp    c0103c60 <__alltraps>

c0103d95 <vector33>:
.globl vector33
vector33:
  pushl $0
c0103d95:	6a 00                	push   $0x0
  pushl $33
c0103d97:	6a 21                	push   $0x21
  jmp __alltraps
c0103d99:	e9 c2 fe ff ff       	jmp    c0103c60 <__alltraps>

c0103d9e <vector34>:
.globl vector34
vector34:
  pushl $0
c0103d9e:	6a 00                	push   $0x0
  pushl $34
c0103da0:	6a 22                	push   $0x22
  jmp __alltraps
c0103da2:	e9 b9 fe ff ff       	jmp    c0103c60 <__alltraps>

c0103da7 <vector35>:
.globl vector35
vector35:
  pushl $0
c0103da7:	6a 00                	push   $0x0
  pushl $35
c0103da9:	6a 23                	push   $0x23
  jmp __alltraps
c0103dab:	e9 b0 fe ff ff       	jmp    c0103c60 <__alltraps>

c0103db0 <vector36>:
.globl vector36
vector36:
  pushl $0
c0103db0:	6a 00                	push   $0x0
  pushl $36
c0103db2:	6a 24                	push   $0x24
  jmp __alltraps
c0103db4:	e9 a7 fe ff ff       	jmp    c0103c60 <__alltraps>

c0103db9 <vector37>:
.globl vector37
vector37:
  pushl $0
c0103db9:	6a 00                	push   $0x0
  pushl $37
c0103dbb:	6a 25                	push   $0x25
  jmp __alltraps
c0103dbd:	e9 9e fe ff ff       	jmp    c0103c60 <__alltraps>

c0103dc2 <vector38>:
.globl vector38
vector38:
  pushl $0
c0103dc2:	6a 00                	push   $0x0
  pushl $38
c0103dc4:	6a 26                	push   $0x26
  jmp __alltraps
c0103dc6:	e9 95 fe ff ff       	jmp    c0103c60 <__alltraps>

c0103dcb <vector39>:
.globl vector39
vector39:
  pushl $0
c0103dcb:	6a 00                	push   $0x0
  pushl $39
c0103dcd:	6a 27                	push   $0x27
  jmp __alltraps
c0103dcf:	e9 8c fe ff ff       	jmp    c0103c60 <__alltraps>

c0103dd4 <vector40>:
.globl vector40
vector40:
  pushl $0
c0103dd4:	6a 00                	push   $0x0
  pushl $40
c0103dd6:	6a 28                	push   $0x28
  jmp __alltraps
c0103dd8:	e9 83 fe ff ff       	jmp    c0103c60 <__alltraps>

c0103ddd <vector41>:
.globl vector41
vector41:
  pushl $0
c0103ddd:	6a 00                	push   $0x0
  pushl $41
c0103ddf:	6a 29                	push   $0x29
  jmp __alltraps
c0103de1:	e9 7a fe ff ff       	jmp    c0103c60 <__alltraps>

c0103de6 <vector42>:
.globl vector42
vector42:
  pushl $0
c0103de6:	6a 00                	push   $0x0
  pushl $42
c0103de8:	6a 2a                	push   $0x2a
  jmp __alltraps
c0103dea:	e9 71 fe ff ff       	jmp    c0103c60 <__alltraps>

c0103def <vector43>:
.globl vector43
vector43:
  pushl $0
c0103def:	6a 00                	push   $0x0
  pushl $43
c0103df1:	6a 2b                	push   $0x2b
  jmp __alltraps
c0103df3:	e9 68 fe ff ff       	jmp    c0103c60 <__alltraps>

c0103df8 <vector44>:
.globl vector44
vector44:
  pushl $0
c0103df8:	6a 00                	push   $0x0
  pushl $44
c0103dfa:	6a 2c                	push   $0x2c
  jmp __alltraps
c0103dfc:	e9 5f fe ff ff       	jmp    c0103c60 <__alltraps>

c0103e01 <vector45>:
.globl vector45
vector45:
  pushl $0
c0103e01:	6a 00                	push   $0x0
  pushl $45
c0103e03:	6a 2d                	push   $0x2d
  jmp __alltraps
c0103e05:	e9 56 fe ff ff       	jmp    c0103c60 <__alltraps>

c0103e0a <vector46>:
.globl vector46
vector46:
  pushl $0
c0103e0a:	6a 00                	push   $0x0
  pushl $46
c0103e0c:	6a 2e                	push   $0x2e
  jmp __alltraps
c0103e0e:	e9 4d fe ff ff       	jmp    c0103c60 <__alltraps>

c0103e13 <vector47>:
.globl vector47
vector47:
  pushl $0
c0103e13:	6a 00                	push   $0x0
  pushl $47
c0103e15:	6a 2f                	push   $0x2f
  jmp __alltraps
c0103e17:	e9 44 fe ff ff       	jmp    c0103c60 <__alltraps>

c0103e1c <vector48>:
.globl vector48
vector48:
  pushl $0
c0103e1c:	6a 00                	push   $0x0
  pushl $48
c0103e1e:	6a 30                	push   $0x30
  jmp __alltraps
c0103e20:	e9 3b fe ff ff       	jmp    c0103c60 <__alltraps>

c0103e25 <vector49>:
.globl vector49
vector49:
  pushl $0
c0103e25:	6a 00                	push   $0x0
  pushl $49
c0103e27:	6a 31                	push   $0x31
  jmp __alltraps
c0103e29:	e9 32 fe ff ff       	jmp    c0103c60 <__alltraps>

c0103e2e <vector50>:
.globl vector50
vector50:
  pushl $0
c0103e2e:	6a 00                	push   $0x0
  pushl $50
c0103e30:	6a 32                	push   $0x32
  jmp __alltraps
c0103e32:	e9 29 fe ff ff       	jmp    c0103c60 <__alltraps>

c0103e37 <vector51>:
.globl vector51
vector51:
  pushl $0
c0103e37:	6a 00                	push   $0x0
  pushl $51
c0103e39:	6a 33                	push   $0x33
  jmp __alltraps
c0103e3b:	e9 20 fe ff ff       	jmp    c0103c60 <__alltraps>

c0103e40 <vector52>:
.globl vector52
vector52:
  pushl $0
c0103e40:	6a 00                	push   $0x0
  pushl $52
c0103e42:	6a 34                	push   $0x34
  jmp __alltraps
c0103e44:	e9 17 fe ff ff       	jmp    c0103c60 <__alltraps>

c0103e49 <vector53>:
.globl vector53
vector53:
  pushl $0
c0103e49:	6a 00                	push   $0x0
  pushl $53
c0103e4b:	6a 35                	push   $0x35
  jmp __alltraps
c0103e4d:	e9 0e fe ff ff       	jmp    c0103c60 <__alltraps>

c0103e52 <vector54>:
.globl vector54
vector54:
  pushl $0
c0103e52:	6a 00                	push   $0x0
  pushl $54
c0103e54:	6a 36                	push   $0x36
  jmp __alltraps
c0103e56:	e9 05 fe ff ff       	jmp    c0103c60 <__alltraps>

c0103e5b <vector55>:
.globl vector55
vector55:
  pushl $0
c0103e5b:	6a 00                	push   $0x0
  pushl $55
c0103e5d:	6a 37                	push   $0x37
  jmp __alltraps
c0103e5f:	e9 fc fd ff ff       	jmp    c0103c60 <__alltraps>

c0103e64 <vector56>:
.globl vector56
vector56:
  pushl $0
c0103e64:	6a 00                	push   $0x0
  pushl $56
c0103e66:	6a 38                	push   $0x38
  jmp __alltraps
c0103e68:	e9 f3 fd ff ff       	jmp    c0103c60 <__alltraps>

c0103e6d <vector57>:
.globl vector57
vector57:
  pushl $0
c0103e6d:	6a 00                	push   $0x0
  pushl $57
c0103e6f:	6a 39                	push   $0x39
  jmp __alltraps
c0103e71:	e9 ea fd ff ff       	jmp    c0103c60 <__alltraps>

c0103e76 <vector58>:
.globl vector58
vector58:
  pushl $0
c0103e76:	6a 00                	push   $0x0
  pushl $58
c0103e78:	6a 3a                	push   $0x3a
  jmp __alltraps
c0103e7a:	e9 e1 fd ff ff       	jmp    c0103c60 <__alltraps>

c0103e7f <vector59>:
.globl vector59
vector59:
  pushl $0
c0103e7f:	6a 00                	push   $0x0
  pushl $59
c0103e81:	6a 3b                	push   $0x3b
  jmp __alltraps
c0103e83:	e9 d8 fd ff ff       	jmp    c0103c60 <__alltraps>

c0103e88 <vector60>:
.globl vector60
vector60:
  pushl $0
c0103e88:	6a 00                	push   $0x0
  pushl $60
c0103e8a:	6a 3c                	push   $0x3c
  jmp __alltraps
c0103e8c:	e9 cf fd ff ff       	jmp    c0103c60 <__alltraps>

c0103e91 <vector61>:
.globl vector61
vector61:
  pushl $0
c0103e91:	6a 00                	push   $0x0
  pushl $61
c0103e93:	6a 3d                	push   $0x3d
  jmp __alltraps
c0103e95:	e9 c6 fd ff ff       	jmp    c0103c60 <__alltraps>

c0103e9a <vector62>:
.globl vector62
vector62:
  pushl $0
c0103e9a:	6a 00                	push   $0x0
  pushl $62
c0103e9c:	6a 3e                	push   $0x3e
  jmp __alltraps
c0103e9e:	e9 bd fd ff ff       	jmp    c0103c60 <__alltraps>

c0103ea3 <vector63>:
.globl vector63
vector63:
  pushl $0
c0103ea3:	6a 00                	push   $0x0
  pushl $63
c0103ea5:	6a 3f                	push   $0x3f
  jmp __alltraps
c0103ea7:	e9 b4 fd ff ff       	jmp    c0103c60 <__alltraps>

c0103eac <vector64>:
.globl vector64
vector64:
  pushl $0
c0103eac:	6a 00                	push   $0x0
  pushl $64
c0103eae:	6a 40                	push   $0x40
  jmp __alltraps
c0103eb0:	e9 ab fd ff ff       	jmp    c0103c60 <__alltraps>

c0103eb5 <vector65>:
.globl vector65
vector65:
  pushl $0
c0103eb5:	6a 00                	push   $0x0
  pushl $65
c0103eb7:	6a 41                	push   $0x41
  jmp __alltraps
c0103eb9:	e9 a2 fd ff ff       	jmp    c0103c60 <__alltraps>

c0103ebe <vector66>:
.globl vector66
vector66:
  pushl $0
c0103ebe:	6a 00                	push   $0x0
  pushl $66
c0103ec0:	6a 42                	push   $0x42
  jmp __alltraps
c0103ec2:	e9 99 fd ff ff       	jmp    c0103c60 <__alltraps>

c0103ec7 <vector67>:
.globl vector67
vector67:
  pushl $0
c0103ec7:	6a 00                	push   $0x0
  pushl $67
c0103ec9:	6a 43                	push   $0x43
  jmp __alltraps
c0103ecb:	e9 90 fd ff ff       	jmp    c0103c60 <__alltraps>

c0103ed0 <vector68>:
.globl vector68
vector68:
  pushl $0
c0103ed0:	6a 00                	push   $0x0
  pushl $68
c0103ed2:	6a 44                	push   $0x44
  jmp __alltraps
c0103ed4:	e9 87 fd ff ff       	jmp    c0103c60 <__alltraps>

c0103ed9 <vector69>:
.globl vector69
vector69:
  pushl $0
c0103ed9:	6a 00                	push   $0x0
  pushl $69
c0103edb:	6a 45                	push   $0x45
  jmp __alltraps
c0103edd:	e9 7e fd ff ff       	jmp    c0103c60 <__alltraps>

c0103ee2 <vector70>:
.globl vector70
vector70:
  pushl $0
c0103ee2:	6a 00                	push   $0x0
  pushl $70
c0103ee4:	6a 46                	push   $0x46
  jmp __alltraps
c0103ee6:	e9 75 fd ff ff       	jmp    c0103c60 <__alltraps>

c0103eeb <vector71>:
.globl vector71
vector71:
  pushl $0
c0103eeb:	6a 00                	push   $0x0
  pushl $71
c0103eed:	6a 47                	push   $0x47
  jmp __alltraps
c0103eef:	e9 6c fd ff ff       	jmp    c0103c60 <__alltraps>

c0103ef4 <vector72>:
.globl vector72
vector72:
  pushl $0
c0103ef4:	6a 00                	push   $0x0
  pushl $72
c0103ef6:	6a 48                	push   $0x48
  jmp __alltraps
c0103ef8:	e9 63 fd ff ff       	jmp    c0103c60 <__alltraps>

c0103efd <vector73>:
.globl vector73
vector73:
  pushl $0
c0103efd:	6a 00                	push   $0x0
  pushl $73
c0103eff:	6a 49                	push   $0x49
  jmp __alltraps
c0103f01:	e9 5a fd ff ff       	jmp    c0103c60 <__alltraps>

c0103f06 <vector74>:
.globl vector74
vector74:
  pushl $0
c0103f06:	6a 00                	push   $0x0
  pushl $74
c0103f08:	6a 4a                	push   $0x4a
  jmp __alltraps
c0103f0a:	e9 51 fd ff ff       	jmp    c0103c60 <__alltraps>

c0103f0f <vector75>:
.globl vector75
vector75:
  pushl $0
c0103f0f:	6a 00                	push   $0x0
  pushl $75
c0103f11:	6a 4b                	push   $0x4b
  jmp __alltraps
c0103f13:	e9 48 fd ff ff       	jmp    c0103c60 <__alltraps>

c0103f18 <vector76>:
.globl vector76
vector76:
  pushl $0
c0103f18:	6a 00                	push   $0x0
  pushl $76
c0103f1a:	6a 4c                	push   $0x4c
  jmp __alltraps
c0103f1c:	e9 3f fd ff ff       	jmp    c0103c60 <__alltraps>

c0103f21 <vector77>:
.globl vector77
vector77:
  pushl $0
c0103f21:	6a 00                	push   $0x0
  pushl $77
c0103f23:	6a 4d                	push   $0x4d
  jmp __alltraps
c0103f25:	e9 36 fd ff ff       	jmp    c0103c60 <__alltraps>

c0103f2a <vector78>:
.globl vector78
vector78:
  pushl $0
c0103f2a:	6a 00                	push   $0x0
  pushl $78
c0103f2c:	6a 4e                	push   $0x4e
  jmp __alltraps
c0103f2e:	e9 2d fd ff ff       	jmp    c0103c60 <__alltraps>

c0103f33 <vector79>:
.globl vector79
vector79:
  pushl $0
c0103f33:	6a 00                	push   $0x0
  pushl $79
c0103f35:	6a 4f                	push   $0x4f
  jmp __alltraps
c0103f37:	e9 24 fd ff ff       	jmp    c0103c60 <__alltraps>

c0103f3c <vector80>:
.globl vector80
vector80:
  pushl $0
c0103f3c:	6a 00                	push   $0x0
  pushl $80
c0103f3e:	6a 50                	push   $0x50
  jmp __alltraps
c0103f40:	e9 1b fd ff ff       	jmp    c0103c60 <__alltraps>

c0103f45 <vector81>:
.globl vector81
vector81:
  pushl $0
c0103f45:	6a 00                	push   $0x0
  pushl $81
c0103f47:	6a 51                	push   $0x51
  jmp __alltraps
c0103f49:	e9 12 fd ff ff       	jmp    c0103c60 <__alltraps>

c0103f4e <vector82>:
.globl vector82
vector82:
  pushl $0
c0103f4e:	6a 00                	push   $0x0
  pushl $82
c0103f50:	6a 52                	push   $0x52
  jmp __alltraps
c0103f52:	e9 09 fd ff ff       	jmp    c0103c60 <__alltraps>

c0103f57 <vector83>:
.globl vector83
vector83:
  pushl $0
c0103f57:	6a 00                	push   $0x0
  pushl $83
c0103f59:	6a 53                	push   $0x53
  jmp __alltraps
c0103f5b:	e9 00 fd ff ff       	jmp    c0103c60 <__alltraps>

c0103f60 <vector84>:
.globl vector84
vector84:
  pushl $0
c0103f60:	6a 00                	push   $0x0
  pushl $84
c0103f62:	6a 54                	push   $0x54
  jmp __alltraps
c0103f64:	e9 f7 fc ff ff       	jmp    c0103c60 <__alltraps>

c0103f69 <vector85>:
.globl vector85
vector85:
  pushl $0
c0103f69:	6a 00                	push   $0x0
  pushl $85
c0103f6b:	6a 55                	push   $0x55
  jmp __alltraps
c0103f6d:	e9 ee fc ff ff       	jmp    c0103c60 <__alltraps>

c0103f72 <vector86>:
.globl vector86
vector86:
  pushl $0
c0103f72:	6a 00                	push   $0x0
  pushl $86
c0103f74:	6a 56                	push   $0x56
  jmp __alltraps
c0103f76:	e9 e5 fc ff ff       	jmp    c0103c60 <__alltraps>

c0103f7b <vector87>:
.globl vector87
vector87:
  pushl $0
c0103f7b:	6a 00                	push   $0x0
  pushl $87
c0103f7d:	6a 57                	push   $0x57
  jmp __alltraps
c0103f7f:	e9 dc fc ff ff       	jmp    c0103c60 <__alltraps>

c0103f84 <vector88>:
.globl vector88
vector88:
  pushl $0
c0103f84:	6a 00                	push   $0x0
  pushl $88
c0103f86:	6a 58                	push   $0x58
  jmp __alltraps
c0103f88:	e9 d3 fc ff ff       	jmp    c0103c60 <__alltraps>

c0103f8d <vector89>:
.globl vector89
vector89:
  pushl $0
c0103f8d:	6a 00                	push   $0x0
  pushl $89
c0103f8f:	6a 59                	push   $0x59
  jmp __alltraps
c0103f91:	e9 ca fc ff ff       	jmp    c0103c60 <__alltraps>

c0103f96 <vector90>:
.globl vector90
vector90:
  pushl $0
c0103f96:	6a 00                	push   $0x0
  pushl $90
c0103f98:	6a 5a                	push   $0x5a
  jmp __alltraps
c0103f9a:	e9 c1 fc ff ff       	jmp    c0103c60 <__alltraps>

c0103f9f <vector91>:
.globl vector91
vector91:
  pushl $0
c0103f9f:	6a 00                	push   $0x0
  pushl $91
c0103fa1:	6a 5b                	push   $0x5b
  jmp __alltraps
c0103fa3:	e9 b8 fc ff ff       	jmp    c0103c60 <__alltraps>

c0103fa8 <vector92>:
.globl vector92
vector92:
  pushl $0
c0103fa8:	6a 00                	push   $0x0
  pushl $92
c0103faa:	6a 5c                	push   $0x5c
  jmp __alltraps
c0103fac:	e9 af fc ff ff       	jmp    c0103c60 <__alltraps>

c0103fb1 <vector93>:
.globl vector93
vector93:
  pushl $0
c0103fb1:	6a 00                	push   $0x0
  pushl $93
c0103fb3:	6a 5d                	push   $0x5d
  jmp __alltraps
c0103fb5:	e9 a6 fc ff ff       	jmp    c0103c60 <__alltraps>

c0103fba <vector94>:
.globl vector94
vector94:
  pushl $0
c0103fba:	6a 00                	push   $0x0
  pushl $94
c0103fbc:	6a 5e                	push   $0x5e
  jmp __alltraps
c0103fbe:	e9 9d fc ff ff       	jmp    c0103c60 <__alltraps>

c0103fc3 <vector95>:
.globl vector95
vector95:
  pushl $0
c0103fc3:	6a 00                	push   $0x0
  pushl $95
c0103fc5:	6a 5f                	push   $0x5f
  jmp __alltraps
c0103fc7:	e9 94 fc ff ff       	jmp    c0103c60 <__alltraps>

c0103fcc <vector96>:
.globl vector96
vector96:
  pushl $0
c0103fcc:	6a 00                	push   $0x0
  pushl $96
c0103fce:	6a 60                	push   $0x60
  jmp __alltraps
c0103fd0:	e9 8b fc ff ff       	jmp    c0103c60 <__alltraps>

c0103fd5 <vector97>:
.globl vector97
vector97:
  pushl $0
c0103fd5:	6a 00                	push   $0x0
  pushl $97
c0103fd7:	6a 61                	push   $0x61
  jmp __alltraps
c0103fd9:	e9 82 fc ff ff       	jmp    c0103c60 <__alltraps>

c0103fde <vector98>:
.globl vector98
vector98:
  pushl $0
c0103fde:	6a 00                	push   $0x0
  pushl $98
c0103fe0:	6a 62                	push   $0x62
  jmp __alltraps
c0103fe2:	e9 79 fc ff ff       	jmp    c0103c60 <__alltraps>

c0103fe7 <vector99>:
.globl vector99
vector99:
  pushl $0
c0103fe7:	6a 00                	push   $0x0
  pushl $99
c0103fe9:	6a 63                	push   $0x63
  jmp __alltraps
c0103feb:	e9 70 fc ff ff       	jmp    c0103c60 <__alltraps>

c0103ff0 <vector100>:
.globl vector100
vector100:
  pushl $0
c0103ff0:	6a 00                	push   $0x0
  pushl $100
c0103ff2:	6a 64                	push   $0x64
  jmp __alltraps
c0103ff4:	e9 67 fc ff ff       	jmp    c0103c60 <__alltraps>

c0103ff9 <vector101>:
.globl vector101
vector101:
  pushl $0
c0103ff9:	6a 00                	push   $0x0
  pushl $101
c0103ffb:	6a 65                	push   $0x65
  jmp __alltraps
c0103ffd:	e9 5e fc ff ff       	jmp    c0103c60 <__alltraps>

c0104002 <vector102>:
.globl vector102
vector102:
  pushl $0
c0104002:	6a 00                	push   $0x0
  pushl $102
c0104004:	6a 66                	push   $0x66
  jmp __alltraps
c0104006:	e9 55 fc ff ff       	jmp    c0103c60 <__alltraps>

c010400b <vector103>:
.globl vector103
vector103:
  pushl $0
c010400b:	6a 00                	push   $0x0
  pushl $103
c010400d:	6a 67                	push   $0x67
  jmp __alltraps
c010400f:	e9 4c fc ff ff       	jmp    c0103c60 <__alltraps>

c0104014 <vector104>:
.globl vector104
vector104:
  pushl $0
c0104014:	6a 00                	push   $0x0
  pushl $104
c0104016:	6a 68                	push   $0x68
  jmp __alltraps
c0104018:	e9 43 fc ff ff       	jmp    c0103c60 <__alltraps>

c010401d <vector105>:
.globl vector105
vector105:
  pushl $0
c010401d:	6a 00                	push   $0x0
  pushl $105
c010401f:	6a 69                	push   $0x69
  jmp __alltraps
c0104021:	e9 3a fc ff ff       	jmp    c0103c60 <__alltraps>

c0104026 <vector106>:
.globl vector106
vector106:
  pushl $0
c0104026:	6a 00                	push   $0x0
  pushl $106
c0104028:	6a 6a                	push   $0x6a
  jmp __alltraps
c010402a:	e9 31 fc ff ff       	jmp    c0103c60 <__alltraps>

c010402f <vector107>:
.globl vector107
vector107:
  pushl $0
c010402f:	6a 00                	push   $0x0
  pushl $107
c0104031:	6a 6b                	push   $0x6b
  jmp __alltraps
c0104033:	e9 28 fc ff ff       	jmp    c0103c60 <__alltraps>

c0104038 <vector108>:
.globl vector108
vector108:
  pushl $0
c0104038:	6a 00                	push   $0x0
  pushl $108
c010403a:	6a 6c                	push   $0x6c
  jmp __alltraps
c010403c:	e9 1f fc ff ff       	jmp    c0103c60 <__alltraps>

c0104041 <vector109>:
.globl vector109
vector109:
  pushl $0
c0104041:	6a 00                	push   $0x0
  pushl $109
c0104043:	6a 6d                	push   $0x6d
  jmp __alltraps
c0104045:	e9 16 fc ff ff       	jmp    c0103c60 <__alltraps>

c010404a <vector110>:
.globl vector110
vector110:
  pushl $0
c010404a:	6a 00                	push   $0x0
  pushl $110
c010404c:	6a 6e                	push   $0x6e
  jmp __alltraps
c010404e:	e9 0d fc ff ff       	jmp    c0103c60 <__alltraps>

c0104053 <vector111>:
.globl vector111
vector111:
  pushl $0
c0104053:	6a 00                	push   $0x0
  pushl $111
c0104055:	6a 6f                	push   $0x6f
  jmp __alltraps
c0104057:	e9 04 fc ff ff       	jmp    c0103c60 <__alltraps>

c010405c <vector112>:
.globl vector112
vector112:
  pushl $0
c010405c:	6a 00                	push   $0x0
  pushl $112
c010405e:	6a 70                	push   $0x70
  jmp __alltraps
c0104060:	e9 fb fb ff ff       	jmp    c0103c60 <__alltraps>

c0104065 <vector113>:
.globl vector113
vector113:
  pushl $0
c0104065:	6a 00                	push   $0x0
  pushl $113
c0104067:	6a 71                	push   $0x71
  jmp __alltraps
c0104069:	e9 f2 fb ff ff       	jmp    c0103c60 <__alltraps>

c010406e <vector114>:
.globl vector114
vector114:
  pushl $0
c010406e:	6a 00                	push   $0x0
  pushl $114
c0104070:	6a 72                	push   $0x72
  jmp __alltraps
c0104072:	e9 e9 fb ff ff       	jmp    c0103c60 <__alltraps>

c0104077 <vector115>:
.globl vector115
vector115:
  pushl $0
c0104077:	6a 00                	push   $0x0
  pushl $115
c0104079:	6a 73                	push   $0x73
  jmp __alltraps
c010407b:	e9 e0 fb ff ff       	jmp    c0103c60 <__alltraps>

c0104080 <vector116>:
.globl vector116
vector116:
  pushl $0
c0104080:	6a 00                	push   $0x0
  pushl $116
c0104082:	6a 74                	push   $0x74
  jmp __alltraps
c0104084:	e9 d7 fb ff ff       	jmp    c0103c60 <__alltraps>

c0104089 <vector117>:
.globl vector117
vector117:
  pushl $0
c0104089:	6a 00                	push   $0x0
  pushl $117
c010408b:	6a 75                	push   $0x75
  jmp __alltraps
c010408d:	e9 ce fb ff ff       	jmp    c0103c60 <__alltraps>

c0104092 <vector118>:
.globl vector118
vector118:
  pushl $0
c0104092:	6a 00                	push   $0x0
  pushl $118
c0104094:	6a 76                	push   $0x76
  jmp __alltraps
c0104096:	e9 c5 fb ff ff       	jmp    c0103c60 <__alltraps>

c010409b <vector119>:
.globl vector119
vector119:
  pushl $0
c010409b:	6a 00                	push   $0x0
  pushl $119
c010409d:	6a 77                	push   $0x77
  jmp __alltraps
c010409f:	e9 bc fb ff ff       	jmp    c0103c60 <__alltraps>

c01040a4 <vector120>:
.globl vector120
vector120:
  pushl $0
c01040a4:	6a 00                	push   $0x0
  pushl $120
c01040a6:	6a 78                	push   $0x78
  jmp __alltraps
c01040a8:	e9 b3 fb ff ff       	jmp    c0103c60 <__alltraps>

c01040ad <vector121>:
.globl vector121
vector121:
  pushl $0
c01040ad:	6a 00                	push   $0x0
  pushl $121
c01040af:	6a 79                	push   $0x79
  jmp __alltraps
c01040b1:	e9 aa fb ff ff       	jmp    c0103c60 <__alltraps>

c01040b6 <vector122>:
.globl vector122
vector122:
  pushl $0
c01040b6:	6a 00                	push   $0x0
  pushl $122
c01040b8:	6a 7a                	push   $0x7a
  jmp __alltraps
c01040ba:	e9 a1 fb ff ff       	jmp    c0103c60 <__alltraps>

c01040bf <vector123>:
.globl vector123
vector123:
  pushl $0
c01040bf:	6a 00                	push   $0x0
  pushl $123
c01040c1:	6a 7b                	push   $0x7b
  jmp __alltraps
c01040c3:	e9 98 fb ff ff       	jmp    c0103c60 <__alltraps>

c01040c8 <vector124>:
.globl vector124
vector124:
  pushl $0
c01040c8:	6a 00                	push   $0x0
  pushl $124
c01040ca:	6a 7c                	push   $0x7c
  jmp __alltraps
c01040cc:	e9 8f fb ff ff       	jmp    c0103c60 <__alltraps>

c01040d1 <vector125>:
.globl vector125
vector125:
  pushl $0
c01040d1:	6a 00                	push   $0x0
  pushl $125
c01040d3:	6a 7d                	push   $0x7d
  jmp __alltraps
c01040d5:	e9 86 fb ff ff       	jmp    c0103c60 <__alltraps>

c01040da <vector126>:
.globl vector126
vector126:
  pushl $0
c01040da:	6a 00                	push   $0x0
  pushl $126
c01040dc:	6a 7e                	push   $0x7e
  jmp __alltraps
c01040de:	e9 7d fb ff ff       	jmp    c0103c60 <__alltraps>

c01040e3 <vector127>:
.globl vector127
vector127:
  pushl $0
c01040e3:	6a 00                	push   $0x0
  pushl $127
c01040e5:	6a 7f                	push   $0x7f
  jmp __alltraps
c01040e7:	e9 74 fb ff ff       	jmp    c0103c60 <__alltraps>

c01040ec <vector128>:
.globl vector128
vector128:
  pushl $0
c01040ec:	6a 00                	push   $0x0
  pushl $128
c01040ee:	68 80 00 00 00       	push   $0x80
  jmp __alltraps
c01040f3:	e9 68 fb ff ff       	jmp    c0103c60 <__alltraps>

c01040f8 <vector129>:
.globl vector129
vector129:
  pushl $0
c01040f8:	6a 00                	push   $0x0
  pushl $129
c01040fa:	68 81 00 00 00       	push   $0x81
  jmp __alltraps
c01040ff:	e9 5c fb ff ff       	jmp    c0103c60 <__alltraps>

c0104104 <vector130>:
.globl vector130
vector130:
  pushl $0
c0104104:	6a 00                	push   $0x0
  pushl $130
c0104106:	68 82 00 00 00       	push   $0x82
  jmp __alltraps
c010410b:	e9 50 fb ff ff       	jmp    c0103c60 <__alltraps>

c0104110 <vector131>:
.globl vector131
vector131:
  pushl $0
c0104110:	6a 00                	push   $0x0
  pushl $131
c0104112:	68 83 00 00 00       	push   $0x83
  jmp __alltraps
c0104117:	e9 44 fb ff ff       	jmp    c0103c60 <__alltraps>

c010411c <vector132>:
.globl vector132
vector132:
  pushl $0
c010411c:	6a 00                	push   $0x0
  pushl $132
c010411e:	68 84 00 00 00       	push   $0x84
  jmp __alltraps
c0104123:	e9 38 fb ff ff       	jmp    c0103c60 <__alltraps>

c0104128 <vector133>:
.globl vector133
vector133:
  pushl $0
c0104128:	6a 00                	push   $0x0
  pushl $133
c010412a:	68 85 00 00 00       	push   $0x85
  jmp __alltraps
c010412f:	e9 2c fb ff ff       	jmp    c0103c60 <__alltraps>

c0104134 <vector134>:
.globl vector134
vector134:
  pushl $0
c0104134:	6a 00                	push   $0x0
  pushl $134
c0104136:	68 86 00 00 00       	push   $0x86
  jmp __alltraps
c010413b:	e9 20 fb ff ff       	jmp    c0103c60 <__alltraps>

c0104140 <vector135>:
.globl vector135
vector135:
  pushl $0
c0104140:	6a 00                	push   $0x0
  pushl $135
c0104142:	68 87 00 00 00       	push   $0x87
  jmp __alltraps
c0104147:	e9 14 fb ff ff       	jmp    c0103c60 <__alltraps>

c010414c <vector136>:
.globl vector136
vector136:
  pushl $0
c010414c:	6a 00                	push   $0x0
  pushl $136
c010414e:	68 88 00 00 00       	push   $0x88
  jmp __alltraps
c0104153:	e9 08 fb ff ff       	jmp    c0103c60 <__alltraps>

c0104158 <vector137>:
.globl vector137
vector137:
  pushl $0
c0104158:	6a 00                	push   $0x0
  pushl $137
c010415a:	68 89 00 00 00       	push   $0x89
  jmp __alltraps
c010415f:	e9 fc fa ff ff       	jmp    c0103c60 <__alltraps>

c0104164 <vector138>:
.globl vector138
vector138:
  pushl $0
c0104164:	6a 00                	push   $0x0
  pushl $138
c0104166:	68 8a 00 00 00       	push   $0x8a
  jmp __alltraps
c010416b:	e9 f0 fa ff ff       	jmp    c0103c60 <__alltraps>

c0104170 <vector139>:
.globl vector139
vector139:
  pushl $0
c0104170:	6a 00                	push   $0x0
  pushl $139
c0104172:	68 8b 00 00 00       	push   $0x8b
  jmp __alltraps
c0104177:	e9 e4 fa ff ff       	jmp    c0103c60 <__alltraps>

c010417c <vector140>:
.globl vector140
vector140:
  pushl $0
c010417c:	6a 00                	push   $0x0
  pushl $140
c010417e:	68 8c 00 00 00       	push   $0x8c
  jmp __alltraps
c0104183:	e9 d8 fa ff ff       	jmp    c0103c60 <__alltraps>

c0104188 <vector141>:
.globl vector141
vector141:
  pushl $0
c0104188:	6a 00                	push   $0x0
  pushl $141
c010418a:	68 8d 00 00 00       	push   $0x8d
  jmp __alltraps
c010418f:	e9 cc fa ff ff       	jmp    c0103c60 <__alltraps>

c0104194 <vector142>:
.globl vector142
vector142:
  pushl $0
c0104194:	6a 00                	push   $0x0
  pushl $142
c0104196:	68 8e 00 00 00       	push   $0x8e
  jmp __alltraps
c010419b:	e9 c0 fa ff ff       	jmp    c0103c60 <__alltraps>

c01041a0 <vector143>:
.globl vector143
vector143:
  pushl $0
c01041a0:	6a 00                	push   $0x0
  pushl $143
c01041a2:	68 8f 00 00 00       	push   $0x8f
  jmp __alltraps
c01041a7:	e9 b4 fa ff ff       	jmp    c0103c60 <__alltraps>

c01041ac <vector144>:
.globl vector144
vector144:
  pushl $0
c01041ac:	6a 00                	push   $0x0
  pushl $144
c01041ae:	68 90 00 00 00       	push   $0x90
  jmp __alltraps
c01041b3:	e9 a8 fa ff ff       	jmp    c0103c60 <__alltraps>

c01041b8 <vector145>:
.globl vector145
vector145:
  pushl $0
c01041b8:	6a 00                	push   $0x0
  pushl $145
c01041ba:	68 91 00 00 00       	push   $0x91
  jmp __alltraps
c01041bf:	e9 9c fa ff ff       	jmp    c0103c60 <__alltraps>

c01041c4 <vector146>:
.globl vector146
vector146:
  pushl $0
c01041c4:	6a 00                	push   $0x0
  pushl $146
c01041c6:	68 92 00 00 00       	push   $0x92
  jmp __alltraps
c01041cb:	e9 90 fa ff ff       	jmp    c0103c60 <__alltraps>

c01041d0 <vector147>:
.globl vector147
vector147:
  pushl $0
c01041d0:	6a 00                	push   $0x0
  pushl $147
c01041d2:	68 93 00 00 00       	push   $0x93
  jmp __alltraps
c01041d7:	e9 84 fa ff ff       	jmp    c0103c60 <__alltraps>

c01041dc <vector148>:
.globl vector148
vector148:
  pushl $0
c01041dc:	6a 00                	push   $0x0
  pushl $148
c01041de:	68 94 00 00 00       	push   $0x94
  jmp __alltraps
c01041e3:	e9 78 fa ff ff       	jmp    c0103c60 <__alltraps>

c01041e8 <vector149>:
.globl vector149
vector149:
  pushl $0
c01041e8:	6a 00                	push   $0x0
  pushl $149
c01041ea:	68 95 00 00 00       	push   $0x95
  jmp __alltraps
c01041ef:	e9 6c fa ff ff       	jmp    c0103c60 <__alltraps>

c01041f4 <vector150>:
.globl vector150
vector150:
  pushl $0
c01041f4:	6a 00                	push   $0x0
  pushl $150
c01041f6:	68 96 00 00 00       	push   $0x96
  jmp __alltraps
c01041fb:	e9 60 fa ff ff       	jmp    c0103c60 <__alltraps>

c0104200 <vector151>:
.globl vector151
vector151:
  pushl $0
c0104200:	6a 00                	push   $0x0
  pushl $151
c0104202:	68 97 00 00 00       	push   $0x97
  jmp __alltraps
c0104207:	e9 54 fa ff ff       	jmp    c0103c60 <__alltraps>

c010420c <vector152>:
.globl vector152
vector152:
  pushl $0
c010420c:	6a 00                	push   $0x0
  pushl $152
c010420e:	68 98 00 00 00       	push   $0x98
  jmp __alltraps
c0104213:	e9 48 fa ff ff       	jmp    c0103c60 <__alltraps>

c0104218 <vector153>:
.globl vector153
vector153:
  pushl $0
c0104218:	6a 00                	push   $0x0
  pushl $153
c010421a:	68 99 00 00 00       	push   $0x99
  jmp __alltraps
c010421f:	e9 3c fa ff ff       	jmp    c0103c60 <__alltraps>

c0104224 <vector154>:
.globl vector154
vector154:
  pushl $0
c0104224:	6a 00                	push   $0x0
  pushl $154
c0104226:	68 9a 00 00 00       	push   $0x9a
  jmp __alltraps
c010422b:	e9 30 fa ff ff       	jmp    c0103c60 <__alltraps>

c0104230 <vector155>:
.globl vector155
vector155:
  pushl $0
c0104230:	6a 00                	push   $0x0
  pushl $155
c0104232:	68 9b 00 00 00       	push   $0x9b
  jmp __alltraps
c0104237:	e9 24 fa ff ff       	jmp    c0103c60 <__alltraps>

c010423c <vector156>:
.globl vector156
vector156:
  pushl $0
c010423c:	6a 00                	push   $0x0
  pushl $156
c010423e:	68 9c 00 00 00       	push   $0x9c
  jmp __alltraps
c0104243:	e9 18 fa ff ff       	jmp    c0103c60 <__alltraps>

c0104248 <vector157>:
.globl vector157
vector157:
  pushl $0
c0104248:	6a 00                	push   $0x0
  pushl $157
c010424a:	68 9d 00 00 00       	push   $0x9d
  jmp __alltraps
c010424f:	e9 0c fa ff ff       	jmp    c0103c60 <__alltraps>

c0104254 <vector158>:
.globl vector158
vector158:
  pushl $0
c0104254:	6a 00                	push   $0x0
  pushl $158
c0104256:	68 9e 00 00 00       	push   $0x9e
  jmp __alltraps
c010425b:	e9 00 fa ff ff       	jmp    c0103c60 <__alltraps>

c0104260 <vector159>:
.globl vector159
vector159:
  pushl $0
c0104260:	6a 00                	push   $0x0
  pushl $159
c0104262:	68 9f 00 00 00       	push   $0x9f
  jmp __alltraps
c0104267:	e9 f4 f9 ff ff       	jmp    c0103c60 <__alltraps>

c010426c <vector160>:
.globl vector160
vector160:
  pushl $0
c010426c:	6a 00                	push   $0x0
  pushl $160
c010426e:	68 a0 00 00 00       	push   $0xa0
  jmp __alltraps
c0104273:	e9 e8 f9 ff ff       	jmp    c0103c60 <__alltraps>

c0104278 <vector161>:
.globl vector161
vector161:
  pushl $0
c0104278:	6a 00                	push   $0x0
  pushl $161
c010427a:	68 a1 00 00 00       	push   $0xa1
  jmp __alltraps
c010427f:	e9 dc f9 ff ff       	jmp    c0103c60 <__alltraps>

c0104284 <vector162>:
.globl vector162
vector162:
  pushl $0
c0104284:	6a 00                	push   $0x0
  pushl $162
c0104286:	68 a2 00 00 00       	push   $0xa2
  jmp __alltraps
c010428b:	e9 d0 f9 ff ff       	jmp    c0103c60 <__alltraps>

c0104290 <vector163>:
.globl vector163
vector163:
  pushl $0
c0104290:	6a 00                	push   $0x0
  pushl $163
c0104292:	68 a3 00 00 00       	push   $0xa3
  jmp __alltraps
c0104297:	e9 c4 f9 ff ff       	jmp    c0103c60 <__alltraps>

c010429c <vector164>:
.globl vector164
vector164:
  pushl $0
c010429c:	6a 00                	push   $0x0
  pushl $164
c010429e:	68 a4 00 00 00       	push   $0xa4
  jmp __alltraps
c01042a3:	e9 b8 f9 ff ff       	jmp    c0103c60 <__alltraps>

c01042a8 <vector165>:
.globl vector165
vector165:
  pushl $0
c01042a8:	6a 00                	push   $0x0
  pushl $165
c01042aa:	68 a5 00 00 00       	push   $0xa5
  jmp __alltraps
c01042af:	e9 ac f9 ff ff       	jmp    c0103c60 <__alltraps>

c01042b4 <vector166>:
.globl vector166
vector166:
  pushl $0
c01042b4:	6a 00                	push   $0x0
  pushl $166
c01042b6:	68 a6 00 00 00       	push   $0xa6
  jmp __alltraps
c01042bb:	e9 a0 f9 ff ff       	jmp    c0103c60 <__alltraps>

c01042c0 <vector167>:
.globl vector167
vector167:
  pushl $0
c01042c0:	6a 00                	push   $0x0
  pushl $167
c01042c2:	68 a7 00 00 00       	push   $0xa7
  jmp __alltraps
c01042c7:	e9 94 f9 ff ff       	jmp    c0103c60 <__alltraps>

c01042cc <vector168>:
.globl vector168
vector168:
  pushl $0
c01042cc:	6a 00                	push   $0x0
  pushl $168
c01042ce:	68 a8 00 00 00       	push   $0xa8
  jmp __alltraps
c01042d3:	e9 88 f9 ff ff       	jmp    c0103c60 <__alltraps>

c01042d8 <vector169>:
.globl vector169
vector169:
  pushl $0
c01042d8:	6a 00                	push   $0x0
  pushl $169
c01042da:	68 a9 00 00 00       	push   $0xa9
  jmp __alltraps
c01042df:	e9 7c f9 ff ff       	jmp    c0103c60 <__alltraps>

c01042e4 <vector170>:
.globl vector170
vector170:
  pushl $0
c01042e4:	6a 00                	push   $0x0
  pushl $170
c01042e6:	68 aa 00 00 00       	push   $0xaa
  jmp __alltraps
c01042eb:	e9 70 f9 ff ff       	jmp    c0103c60 <__alltraps>

c01042f0 <vector171>:
.globl vector171
vector171:
  pushl $0
c01042f0:	6a 00                	push   $0x0
  pushl $171
c01042f2:	68 ab 00 00 00       	push   $0xab
  jmp __alltraps
c01042f7:	e9 64 f9 ff ff       	jmp    c0103c60 <__alltraps>

c01042fc <vector172>:
.globl vector172
vector172:
  pushl $0
c01042fc:	6a 00                	push   $0x0
  pushl $172
c01042fe:	68 ac 00 00 00       	push   $0xac
  jmp __alltraps
c0104303:	e9 58 f9 ff ff       	jmp    c0103c60 <__alltraps>

c0104308 <vector173>:
.globl vector173
vector173:
  pushl $0
c0104308:	6a 00                	push   $0x0
  pushl $173
c010430a:	68 ad 00 00 00       	push   $0xad
  jmp __alltraps
c010430f:	e9 4c f9 ff ff       	jmp    c0103c60 <__alltraps>

c0104314 <vector174>:
.globl vector174
vector174:
  pushl $0
c0104314:	6a 00                	push   $0x0
  pushl $174
c0104316:	68 ae 00 00 00       	push   $0xae
  jmp __alltraps
c010431b:	e9 40 f9 ff ff       	jmp    c0103c60 <__alltraps>

c0104320 <vector175>:
.globl vector175
vector175:
  pushl $0
c0104320:	6a 00                	push   $0x0
  pushl $175
c0104322:	68 af 00 00 00       	push   $0xaf
  jmp __alltraps
c0104327:	e9 34 f9 ff ff       	jmp    c0103c60 <__alltraps>

c010432c <vector176>:
.globl vector176
vector176:
  pushl $0
c010432c:	6a 00                	push   $0x0
  pushl $176
c010432e:	68 b0 00 00 00       	push   $0xb0
  jmp __alltraps
c0104333:	e9 28 f9 ff ff       	jmp    c0103c60 <__alltraps>

c0104338 <vector177>:
.globl vector177
vector177:
  pushl $0
c0104338:	6a 00                	push   $0x0
  pushl $177
c010433a:	68 b1 00 00 00       	push   $0xb1
  jmp __alltraps
c010433f:	e9 1c f9 ff ff       	jmp    c0103c60 <__alltraps>

c0104344 <vector178>:
.globl vector178
vector178:
  pushl $0
c0104344:	6a 00                	push   $0x0
  pushl $178
c0104346:	68 b2 00 00 00       	push   $0xb2
  jmp __alltraps
c010434b:	e9 10 f9 ff ff       	jmp    c0103c60 <__alltraps>

c0104350 <vector179>:
.globl vector179
vector179:
  pushl $0
c0104350:	6a 00                	push   $0x0
  pushl $179
c0104352:	68 b3 00 00 00       	push   $0xb3
  jmp __alltraps
c0104357:	e9 04 f9 ff ff       	jmp    c0103c60 <__alltraps>

c010435c <vector180>:
.globl vector180
vector180:
  pushl $0
c010435c:	6a 00                	push   $0x0
  pushl $180
c010435e:	68 b4 00 00 00       	push   $0xb4
  jmp __alltraps
c0104363:	e9 f8 f8 ff ff       	jmp    c0103c60 <__alltraps>

c0104368 <vector181>:
.globl vector181
vector181:
  pushl $0
c0104368:	6a 00                	push   $0x0
  pushl $181
c010436a:	68 b5 00 00 00       	push   $0xb5
  jmp __alltraps
c010436f:	e9 ec f8 ff ff       	jmp    c0103c60 <__alltraps>

c0104374 <vector182>:
.globl vector182
vector182:
  pushl $0
c0104374:	6a 00                	push   $0x0
  pushl $182
c0104376:	68 b6 00 00 00       	push   $0xb6
  jmp __alltraps
c010437b:	e9 e0 f8 ff ff       	jmp    c0103c60 <__alltraps>

c0104380 <vector183>:
.globl vector183
vector183:
  pushl $0
c0104380:	6a 00                	push   $0x0
  pushl $183
c0104382:	68 b7 00 00 00       	push   $0xb7
  jmp __alltraps
c0104387:	e9 d4 f8 ff ff       	jmp    c0103c60 <__alltraps>

c010438c <vector184>:
.globl vector184
vector184:
  pushl $0
c010438c:	6a 00                	push   $0x0
  pushl $184
c010438e:	68 b8 00 00 00       	push   $0xb8
  jmp __alltraps
c0104393:	e9 c8 f8 ff ff       	jmp    c0103c60 <__alltraps>

c0104398 <vector185>:
.globl vector185
vector185:
  pushl $0
c0104398:	6a 00                	push   $0x0
  pushl $185
c010439a:	68 b9 00 00 00       	push   $0xb9
  jmp __alltraps
c010439f:	e9 bc f8 ff ff       	jmp    c0103c60 <__alltraps>

c01043a4 <vector186>:
.globl vector186
vector186:
  pushl $0
c01043a4:	6a 00                	push   $0x0
  pushl $186
c01043a6:	68 ba 00 00 00       	push   $0xba
  jmp __alltraps
c01043ab:	e9 b0 f8 ff ff       	jmp    c0103c60 <__alltraps>

c01043b0 <vector187>:
.globl vector187
vector187:
  pushl $0
c01043b0:	6a 00                	push   $0x0
  pushl $187
c01043b2:	68 bb 00 00 00       	push   $0xbb
  jmp __alltraps
c01043b7:	e9 a4 f8 ff ff       	jmp    c0103c60 <__alltraps>

c01043bc <vector188>:
.globl vector188
vector188:
  pushl $0
c01043bc:	6a 00                	push   $0x0
  pushl $188
c01043be:	68 bc 00 00 00       	push   $0xbc
  jmp __alltraps
c01043c3:	e9 98 f8 ff ff       	jmp    c0103c60 <__alltraps>

c01043c8 <vector189>:
.globl vector189
vector189:
  pushl $0
c01043c8:	6a 00                	push   $0x0
  pushl $189
c01043ca:	68 bd 00 00 00       	push   $0xbd
  jmp __alltraps
c01043cf:	e9 8c f8 ff ff       	jmp    c0103c60 <__alltraps>

c01043d4 <vector190>:
.globl vector190
vector190:
  pushl $0
c01043d4:	6a 00                	push   $0x0
  pushl $190
c01043d6:	68 be 00 00 00       	push   $0xbe
  jmp __alltraps
c01043db:	e9 80 f8 ff ff       	jmp    c0103c60 <__alltraps>

c01043e0 <vector191>:
.globl vector191
vector191:
  pushl $0
c01043e0:	6a 00                	push   $0x0
  pushl $191
c01043e2:	68 bf 00 00 00       	push   $0xbf
  jmp __alltraps
c01043e7:	e9 74 f8 ff ff       	jmp    c0103c60 <__alltraps>

c01043ec <vector192>:
.globl vector192
vector192:
  pushl $0
c01043ec:	6a 00                	push   $0x0
  pushl $192
c01043ee:	68 c0 00 00 00       	push   $0xc0
  jmp __alltraps
c01043f3:	e9 68 f8 ff ff       	jmp    c0103c60 <__alltraps>

c01043f8 <vector193>:
.globl vector193
vector193:
  pushl $0
c01043f8:	6a 00                	push   $0x0
  pushl $193
c01043fa:	68 c1 00 00 00       	push   $0xc1
  jmp __alltraps
c01043ff:	e9 5c f8 ff ff       	jmp    c0103c60 <__alltraps>

c0104404 <vector194>:
.globl vector194
vector194:
  pushl $0
c0104404:	6a 00                	push   $0x0
  pushl $194
c0104406:	68 c2 00 00 00       	push   $0xc2
  jmp __alltraps
c010440b:	e9 50 f8 ff ff       	jmp    c0103c60 <__alltraps>

c0104410 <vector195>:
.globl vector195
vector195:
  pushl $0
c0104410:	6a 00                	push   $0x0
  pushl $195
c0104412:	68 c3 00 00 00       	push   $0xc3
  jmp __alltraps
c0104417:	e9 44 f8 ff ff       	jmp    c0103c60 <__alltraps>

c010441c <vector196>:
.globl vector196
vector196:
  pushl $0
c010441c:	6a 00                	push   $0x0
  pushl $196
c010441e:	68 c4 00 00 00       	push   $0xc4
  jmp __alltraps
c0104423:	e9 38 f8 ff ff       	jmp    c0103c60 <__alltraps>

c0104428 <vector197>:
.globl vector197
vector197:
  pushl $0
c0104428:	6a 00                	push   $0x0
  pushl $197
c010442a:	68 c5 00 00 00       	push   $0xc5
  jmp __alltraps
c010442f:	e9 2c f8 ff ff       	jmp    c0103c60 <__alltraps>

c0104434 <vector198>:
.globl vector198
vector198:
  pushl $0
c0104434:	6a 00                	push   $0x0
  pushl $198
c0104436:	68 c6 00 00 00       	push   $0xc6
  jmp __alltraps
c010443b:	e9 20 f8 ff ff       	jmp    c0103c60 <__alltraps>

c0104440 <vector199>:
.globl vector199
vector199:
  pushl $0
c0104440:	6a 00                	push   $0x0
  pushl $199
c0104442:	68 c7 00 00 00       	push   $0xc7
  jmp __alltraps
c0104447:	e9 14 f8 ff ff       	jmp    c0103c60 <__alltraps>

c010444c <vector200>:
.globl vector200
vector200:
  pushl $0
c010444c:	6a 00                	push   $0x0
  pushl $200
c010444e:	68 c8 00 00 00       	push   $0xc8
  jmp __alltraps
c0104453:	e9 08 f8 ff ff       	jmp    c0103c60 <__alltraps>

c0104458 <vector201>:
.globl vector201
vector201:
  pushl $0
c0104458:	6a 00                	push   $0x0
  pushl $201
c010445a:	68 c9 00 00 00       	push   $0xc9
  jmp __alltraps
c010445f:	e9 fc f7 ff ff       	jmp    c0103c60 <__alltraps>

c0104464 <vector202>:
.globl vector202
vector202:
  pushl $0
c0104464:	6a 00                	push   $0x0
  pushl $202
c0104466:	68 ca 00 00 00       	push   $0xca
  jmp __alltraps
c010446b:	e9 f0 f7 ff ff       	jmp    c0103c60 <__alltraps>

c0104470 <vector203>:
.globl vector203
vector203:
  pushl $0
c0104470:	6a 00                	push   $0x0
  pushl $203
c0104472:	68 cb 00 00 00       	push   $0xcb
  jmp __alltraps
c0104477:	e9 e4 f7 ff ff       	jmp    c0103c60 <__alltraps>

c010447c <vector204>:
.globl vector204
vector204:
  pushl $0
c010447c:	6a 00                	push   $0x0
  pushl $204
c010447e:	68 cc 00 00 00       	push   $0xcc
  jmp __alltraps
c0104483:	e9 d8 f7 ff ff       	jmp    c0103c60 <__alltraps>

c0104488 <vector205>:
.globl vector205
vector205:
  pushl $0
c0104488:	6a 00                	push   $0x0
  pushl $205
c010448a:	68 cd 00 00 00       	push   $0xcd
  jmp __alltraps
c010448f:	e9 cc f7 ff ff       	jmp    c0103c60 <__alltraps>

c0104494 <vector206>:
.globl vector206
vector206:
  pushl $0
c0104494:	6a 00                	push   $0x0
  pushl $206
c0104496:	68 ce 00 00 00       	push   $0xce
  jmp __alltraps
c010449b:	e9 c0 f7 ff ff       	jmp    c0103c60 <__alltraps>

c01044a0 <vector207>:
.globl vector207
vector207:
  pushl $0
c01044a0:	6a 00                	push   $0x0
  pushl $207
c01044a2:	68 cf 00 00 00       	push   $0xcf
  jmp __alltraps
c01044a7:	e9 b4 f7 ff ff       	jmp    c0103c60 <__alltraps>

c01044ac <vector208>:
.globl vector208
vector208:
  pushl $0
c01044ac:	6a 00                	push   $0x0
  pushl $208
c01044ae:	68 d0 00 00 00       	push   $0xd0
  jmp __alltraps
c01044b3:	e9 a8 f7 ff ff       	jmp    c0103c60 <__alltraps>

c01044b8 <vector209>:
.globl vector209
vector209:
  pushl $0
c01044b8:	6a 00                	push   $0x0
  pushl $209
c01044ba:	68 d1 00 00 00       	push   $0xd1
  jmp __alltraps
c01044bf:	e9 9c f7 ff ff       	jmp    c0103c60 <__alltraps>

c01044c4 <vector210>:
.globl vector210
vector210:
  pushl $0
c01044c4:	6a 00                	push   $0x0
  pushl $210
c01044c6:	68 d2 00 00 00       	push   $0xd2
  jmp __alltraps
c01044cb:	e9 90 f7 ff ff       	jmp    c0103c60 <__alltraps>

c01044d0 <vector211>:
.globl vector211
vector211:
  pushl $0
c01044d0:	6a 00                	push   $0x0
  pushl $211
c01044d2:	68 d3 00 00 00       	push   $0xd3
  jmp __alltraps
c01044d7:	e9 84 f7 ff ff       	jmp    c0103c60 <__alltraps>

c01044dc <vector212>:
.globl vector212
vector212:
  pushl $0
c01044dc:	6a 00                	push   $0x0
  pushl $212
c01044de:	68 d4 00 00 00       	push   $0xd4
  jmp __alltraps
c01044e3:	e9 78 f7 ff ff       	jmp    c0103c60 <__alltraps>

c01044e8 <vector213>:
.globl vector213
vector213:
  pushl $0
c01044e8:	6a 00                	push   $0x0
  pushl $213
c01044ea:	68 d5 00 00 00       	push   $0xd5
  jmp __alltraps
c01044ef:	e9 6c f7 ff ff       	jmp    c0103c60 <__alltraps>

c01044f4 <vector214>:
.globl vector214
vector214:
  pushl $0
c01044f4:	6a 00                	push   $0x0
  pushl $214
c01044f6:	68 d6 00 00 00       	push   $0xd6
  jmp __alltraps
c01044fb:	e9 60 f7 ff ff       	jmp    c0103c60 <__alltraps>

c0104500 <vector215>:
.globl vector215
vector215:
  pushl $0
c0104500:	6a 00                	push   $0x0
  pushl $215
c0104502:	68 d7 00 00 00       	push   $0xd7
  jmp __alltraps
c0104507:	e9 54 f7 ff ff       	jmp    c0103c60 <__alltraps>

c010450c <vector216>:
.globl vector216
vector216:
  pushl $0
c010450c:	6a 00                	push   $0x0
  pushl $216
c010450e:	68 d8 00 00 00       	push   $0xd8
  jmp __alltraps
c0104513:	e9 48 f7 ff ff       	jmp    c0103c60 <__alltraps>

c0104518 <vector217>:
.globl vector217
vector217:
  pushl $0
c0104518:	6a 00                	push   $0x0
  pushl $217
c010451a:	68 d9 00 00 00       	push   $0xd9
  jmp __alltraps
c010451f:	e9 3c f7 ff ff       	jmp    c0103c60 <__alltraps>

c0104524 <vector218>:
.globl vector218
vector218:
  pushl $0
c0104524:	6a 00                	push   $0x0
  pushl $218
c0104526:	68 da 00 00 00       	push   $0xda
  jmp __alltraps
c010452b:	e9 30 f7 ff ff       	jmp    c0103c60 <__alltraps>

c0104530 <vector219>:
.globl vector219
vector219:
  pushl $0
c0104530:	6a 00                	push   $0x0
  pushl $219
c0104532:	68 db 00 00 00       	push   $0xdb
  jmp __alltraps
c0104537:	e9 24 f7 ff ff       	jmp    c0103c60 <__alltraps>

c010453c <vector220>:
.globl vector220
vector220:
  pushl $0
c010453c:	6a 00                	push   $0x0
  pushl $220
c010453e:	68 dc 00 00 00       	push   $0xdc
  jmp __alltraps
c0104543:	e9 18 f7 ff ff       	jmp    c0103c60 <__alltraps>

c0104548 <vector221>:
.globl vector221
vector221:
  pushl $0
c0104548:	6a 00                	push   $0x0
  pushl $221
c010454a:	68 dd 00 00 00       	push   $0xdd
  jmp __alltraps
c010454f:	e9 0c f7 ff ff       	jmp    c0103c60 <__alltraps>

c0104554 <vector222>:
.globl vector222
vector222:
  pushl $0
c0104554:	6a 00                	push   $0x0
  pushl $222
c0104556:	68 de 00 00 00       	push   $0xde
  jmp __alltraps
c010455b:	e9 00 f7 ff ff       	jmp    c0103c60 <__alltraps>

c0104560 <vector223>:
.globl vector223
vector223:
  pushl $0
c0104560:	6a 00                	push   $0x0
  pushl $223
c0104562:	68 df 00 00 00       	push   $0xdf
  jmp __alltraps
c0104567:	e9 f4 f6 ff ff       	jmp    c0103c60 <__alltraps>

c010456c <vector224>:
.globl vector224
vector224:
  pushl $0
c010456c:	6a 00                	push   $0x0
  pushl $224
c010456e:	68 e0 00 00 00       	push   $0xe0
  jmp __alltraps
c0104573:	e9 e8 f6 ff ff       	jmp    c0103c60 <__alltraps>

c0104578 <vector225>:
.globl vector225
vector225:
  pushl $0
c0104578:	6a 00                	push   $0x0
  pushl $225
c010457a:	68 e1 00 00 00       	push   $0xe1
  jmp __alltraps
c010457f:	e9 dc f6 ff ff       	jmp    c0103c60 <__alltraps>

c0104584 <vector226>:
.globl vector226
vector226:
  pushl $0
c0104584:	6a 00                	push   $0x0
  pushl $226
c0104586:	68 e2 00 00 00       	push   $0xe2
  jmp __alltraps
c010458b:	e9 d0 f6 ff ff       	jmp    c0103c60 <__alltraps>

c0104590 <vector227>:
.globl vector227
vector227:
  pushl $0
c0104590:	6a 00                	push   $0x0
  pushl $227
c0104592:	68 e3 00 00 00       	push   $0xe3
  jmp __alltraps
c0104597:	e9 c4 f6 ff ff       	jmp    c0103c60 <__alltraps>

c010459c <vector228>:
.globl vector228
vector228:
  pushl $0
c010459c:	6a 00                	push   $0x0
  pushl $228
c010459e:	68 e4 00 00 00       	push   $0xe4
  jmp __alltraps
c01045a3:	e9 b8 f6 ff ff       	jmp    c0103c60 <__alltraps>

c01045a8 <vector229>:
.globl vector229
vector229:
  pushl $0
c01045a8:	6a 00                	push   $0x0
  pushl $229
c01045aa:	68 e5 00 00 00       	push   $0xe5
  jmp __alltraps
c01045af:	e9 ac f6 ff ff       	jmp    c0103c60 <__alltraps>

c01045b4 <vector230>:
.globl vector230
vector230:
  pushl $0
c01045b4:	6a 00                	push   $0x0
  pushl $230
c01045b6:	68 e6 00 00 00       	push   $0xe6
  jmp __alltraps
c01045bb:	e9 a0 f6 ff ff       	jmp    c0103c60 <__alltraps>

c01045c0 <vector231>:
.globl vector231
vector231:
  pushl $0
c01045c0:	6a 00                	push   $0x0
  pushl $231
c01045c2:	68 e7 00 00 00       	push   $0xe7
  jmp __alltraps
c01045c7:	e9 94 f6 ff ff       	jmp    c0103c60 <__alltraps>

c01045cc <vector232>:
.globl vector232
vector232:
  pushl $0
c01045cc:	6a 00                	push   $0x0
  pushl $232
c01045ce:	68 e8 00 00 00       	push   $0xe8
  jmp __alltraps
c01045d3:	e9 88 f6 ff ff       	jmp    c0103c60 <__alltraps>

c01045d8 <vector233>:
.globl vector233
vector233:
  pushl $0
c01045d8:	6a 00                	push   $0x0
  pushl $233
c01045da:	68 e9 00 00 00       	push   $0xe9
  jmp __alltraps
c01045df:	e9 7c f6 ff ff       	jmp    c0103c60 <__alltraps>

c01045e4 <vector234>:
.globl vector234
vector234:
  pushl $0
c01045e4:	6a 00                	push   $0x0
  pushl $234
c01045e6:	68 ea 00 00 00       	push   $0xea
  jmp __alltraps
c01045eb:	e9 70 f6 ff ff       	jmp    c0103c60 <__alltraps>

c01045f0 <vector235>:
.globl vector235
vector235:
  pushl $0
c01045f0:	6a 00                	push   $0x0
  pushl $235
c01045f2:	68 eb 00 00 00       	push   $0xeb
  jmp __alltraps
c01045f7:	e9 64 f6 ff ff       	jmp    c0103c60 <__alltraps>

c01045fc <vector236>:
.globl vector236
vector236:
  pushl $0
c01045fc:	6a 00                	push   $0x0
  pushl $236
c01045fe:	68 ec 00 00 00       	push   $0xec
  jmp __alltraps
c0104603:	e9 58 f6 ff ff       	jmp    c0103c60 <__alltraps>

c0104608 <vector237>:
.globl vector237
vector237:
  pushl $0
c0104608:	6a 00                	push   $0x0
  pushl $237
c010460a:	68 ed 00 00 00       	push   $0xed
  jmp __alltraps
c010460f:	e9 4c f6 ff ff       	jmp    c0103c60 <__alltraps>

c0104614 <vector238>:
.globl vector238
vector238:
  pushl $0
c0104614:	6a 00                	push   $0x0
  pushl $238
c0104616:	68 ee 00 00 00       	push   $0xee
  jmp __alltraps
c010461b:	e9 40 f6 ff ff       	jmp    c0103c60 <__alltraps>

c0104620 <vector239>:
.globl vector239
vector239:
  pushl $0
c0104620:	6a 00                	push   $0x0
  pushl $239
c0104622:	68 ef 00 00 00       	push   $0xef
  jmp __alltraps
c0104627:	e9 34 f6 ff ff       	jmp    c0103c60 <__alltraps>

c010462c <vector240>:
.globl vector240
vector240:
  pushl $0
c010462c:	6a 00                	push   $0x0
  pushl $240
c010462e:	68 f0 00 00 00       	push   $0xf0
  jmp __alltraps
c0104633:	e9 28 f6 ff ff       	jmp    c0103c60 <__alltraps>

c0104638 <vector241>:
.globl vector241
vector241:
  pushl $0
c0104638:	6a 00                	push   $0x0
  pushl $241
c010463a:	68 f1 00 00 00       	push   $0xf1
  jmp __alltraps
c010463f:	e9 1c f6 ff ff       	jmp    c0103c60 <__alltraps>

c0104644 <vector242>:
.globl vector242
vector242:
  pushl $0
c0104644:	6a 00                	push   $0x0
  pushl $242
c0104646:	68 f2 00 00 00       	push   $0xf2
  jmp __alltraps
c010464b:	e9 10 f6 ff ff       	jmp    c0103c60 <__alltraps>

c0104650 <vector243>:
.globl vector243
vector243:
  pushl $0
c0104650:	6a 00                	push   $0x0
  pushl $243
c0104652:	68 f3 00 00 00       	push   $0xf3
  jmp __alltraps
c0104657:	e9 04 f6 ff ff       	jmp    c0103c60 <__alltraps>

c010465c <vector244>:
.globl vector244
vector244:
  pushl $0
c010465c:	6a 00                	push   $0x0
  pushl $244
c010465e:	68 f4 00 00 00       	push   $0xf4
  jmp __alltraps
c0104663:	e9 f8 f5 ff ff       	jmp    c0103c60 <__alltraps>

c0104668 <vector245>:
.globl vector245
vector245:
  pushl $0
c0104668:	6a 00                	push   $0x0
  pushl $245
c010466a:	68 f5 00 00 00       	push   $0xf5
  jmp __alltraps
c010466f:	e9 ec f5 ff ff       	jmp    c0103c60 <__alltraps>

c0104674 <vector246>:
.globl vector246
vector246:
  pushl $0
c0104674:	6a 00                	push   $0x0
  pushl $246
c0104676:	68 f6 00 00 00       	push   $0xf6
  jmp __alltraps
c010467b:	e9 e0 f5 ff ff       	jmp    c0103c60 <__alltraps>

c0104680 <vector247>:
.globl vector247
vector247:
  pushl $0
c0104680:	6a 00                	push   $0x0
  pushl $247
c0104682:	68 f7 00 00 00       	push   $0xf7
  jmp __alltraps
c0104687:	e9 d4 f5 ff ff       	jmp    c0103c60 <__alltraps>

c010468c <vector248>:
.globl vector248
vector248:
  pushl $0
c010468c:	6a 00                	push   $0x0
  pushl $248
c010468e:	68 f8 00 00 00       	push   $0xf8
  jmp __alltraps
c0104693:	e9 c8 f5 ff ff       	jmp    c0103c60 <__alltraps>

c0104698 <vector249>:
.globl vector249
vector249:
  pushl $0
c0104698:	6a 00                	push   $0x0
  pushl $249
c010469a:	68 f9 00 00 00       	push   $0xf9
  jmp __alltraps
c010469f:	e9 bc f5 ff ff       	jmp    c0103c60 <__alltraps>

c01046a4 <vector250>:
.globl vector250
vector250:
  pushl $0
c01046a4:	6a 00                	push   $0x0
  pushl $250
c01046a6:	68 fa 00 00 00       	push   $0xfa
  jmp __alltraps
c01046ab:	e9 b0 f5 ff ff       	jmp    c0103c60 <__alltraps>

c01046b0 <vector251>:
.globl vector251
vector251:
  pushl $0
c01046b0:	6a 00                	push   $0x0
  pushl $251
c01046b2:	68 fb 00 00 00       	push   $0xfb
  jmp __alltraps
c01046b7:	e9 a4 f5 ff ff       	jmp    c0103c60 <__alltraps>

c01046bc <vector252>:
.globl vector252
vector252:
  pushl $0
c01046bc:	6a 00                	push   $0x0
  pushl $252
c01046be:	68 fc 00 00 00       	push   $0xfc
  jmp __alltraps
c01046c3:	e9 98 f5 ff ff       	jmp    c0103c60 <__alltraps>

c01046c8 <vector253>:
.globl vector253
vector253:
  pushl $0
c01046c8:	6a 00                	push   $0x0
  pushl $253
c01046ca:	68 fd 00 00 00       	push   $0xfd
  jmp __alltraps
c01046cf:	e9 8c f5 ff ff       	jmp    c0103c60 <__alltraps>

c01046d4 <vector254>:
.globl vector254
vector254:
  pushl $0
c01046d4:	6a 00                	push   $0x0
  pushl $254
c01046d6:	68 fe 00 00 00       	push   $0xfe
  jmp __alltraps
c01046db:	e9 80 f5 ff ff       	jmp    c0103c60 <__alltraps>

c01046e0 <vector255>:
.globl vector255
vector255:
  pushl $0
c01046e0:	6a 00                	push   $0x0
  pushl $255
c01046e2:	68 ff 00 00 00       	push   $0xff
  jmp __alltraps
c01046e7:	e9 74 f5 ff ff       	jmp    c0103c60 <__alltraps>

c01046ec <page2ppn>:

extern struct Page *pages;
extern size_t npage;

static inline ppn_t
page2ppn(struct Page *page) {
c01046ec:	55                   	push   %ebp
c01046ed:	89 e5                	mov    %esp,%ebp
    return page - pages;
c01046ef:	8b 55 08             	mov    0x8(%ebp),%edx
c01046f2:	a1 b4 8c 12 c0       	mov    0xc0128cb4,%eax
c01046f7:	89 d1                	mov    %edx,%ecx
c01046f9:	29 c1                	sub    %eax,%ecx
c01046fb:	89 c8                	mov    %ecx,%eax
c01046fd:	c1 f8 03             	sar    $0x3,%eax
c0104700:	69 c0 ab aa aa aa    	imul   $0xaaaaaaab,%eax,%eax
}
c0104706:	5d                   	pop    %ebp
c0104707:	c3                   	ret    

c0104708 <set_page_ref>:
page_ref(struct Page *page) {
    return atomic_read(&(page->ref));
}

static inline void
set_page_ref(struct Page *page, int val) {
c0104708:	55                   	push   %ebp
c0104709:	89 e5                	mov    %esp,%ebp
c010470b:	83 ec 10             	sub    $0x10,%esp
    atomic_set(&(page->ref), val);
c010470e:	8b 45 08             	mov    0x8(%ebp),%eax
c0104711:	89 45 fc             	mov    %eax,-0x4(%ebp)
c0104714:	8b 45 0c             	mov    0xc(%ebp),%eax
c0104717:	89 45 f8             	mov    %eax,-0x8(%ebp)
 *
 * Atomically sets the value of @v to @i.
 * */
static inline void
atomic_set(atomic_t *v, int i) {
    v->counter = i;
c010471a:	8b 45 fc             	mov    -0x4(%ebp),%eax
c010471d:	8b 55 f8             	mov    -0x8(%ebp),%edx
c0104720:	89 10                	mov    %edx,(%eax)
}
c0104722:	c9                   	leave  
c0104723:	c3                   	ret    

c0104724 <buddy_init>:
    struct Page *mem_base;
} zones[MAX_ZONE_NUM] = {{NULL}};

//buddy_init - init the free_list(0 ~ MAX_ORDER) & reset nr_free(0 ~ MAX_ORDER)
static void
buddy_init(void) {
c0104724:	55                   	push   %ebp
c0104725:	89 e5                	mov    %esp,%ebp
c0104727:	83 ec 10             	sub    $0x10,%esp
    int i;
    for (i = 0; i <= MAX_ORDER; i ++) {
c010472a:	c7 45 f8 00 00 00 00 	movl   $0x0,-0x8(%ebp)
c0104731:	eb 42                	jmp    c0104775 <buddy_init+0x51>
        list_init(&free_list(i));
c0104733:	8b 55 f8             	mov    -0x8(%ebp),%edx
c0104736:	89 d0                	mov    %edx,%eax
c0104738:	01 c0                	add    %eax,%eax
c010473a:	01 d0                	add    %edx,%eax
c010473c:	c1 e0 02             	shl    $0x2,%eax
c010473f:	05 60 89 12 c0       	add    $0xc0128960,%eax
c0104744:	89 45 fc             	mov    %eax,-0x4(%ebp)
 * list_init - initialize a new entry
 * @elm:        new entry to be initialized
 * */
static inline void
list_init(list_entry_t *elm) {
    elm->prev = elm->next = elm;
c0104747:	8b 45 fc             	mov    -0x4(%ebp),%eax
c010474a:	8b 55 fc             	mov    -0x4(%ebp),%edx
c010474d:	89 50 04             	mov    %edx,0x4(%eax)
c0104750:	8b 45 fc             	mov    -0x4(%ebp),%eax
c0104753:	8b 50 04             	mov    0x4(%eax),%edx
c0104756:	8b 45 fc             	mov    -0x4(%ebp),%eax
c0104759:	89 10                	mov    %edx,(%eax)
        nr_free(i) = 0;
c010475b:	8b 55 f8             	mov    -0x8(%ebp),%edx
c010475e:	89 d0                	mov    %edx,%eax
c0104760:	01 c0                	add    %eax,%eax
c0104762:	01 d0                	add    %edx,%eax
c0104764:	c1 e0 02             	shl    $0x2,%eax
c0104767:	c7 80 68 89 12 c0 00 	movl   $0x0,-0x3fed7698(%eax)
c010476e:	00 00 00 

//buddy_init - init the free_list(0 ~ MAX_ORDER) & reset nr_free(0 ~ MAX_ORDER)
static void
buddy_init(void) {
    int i;
    for (i = 0; i <= MAX_ORDER; i ++) {
c0104771:	83 45 f8 01          	addl   $0x1,-0x8(%ebp)
c0104775:	83 7d f8 0a          	cmpl   $0xa,-0x8(%ebp)
c0104779:	7e b8                	jle    c0104733 <buddy_init+0xf>
        list_init(&free_list(i));
        nr_free(i) = 0;
    }
}
c010477b:	c9                   	leave  
c010477c:	c3                   	ret    

c010477d <buddy_init_memmap>:

//buddy_init_memmap - build free_list for Page base follow  n continuous pages.
static void
buddy_init_memmap(struct Page *base, size_t n) {
c010477d:	55                   	push   %ebp
c010477e:	89 e5                	mov    %esp,%ebp
c0104780:	53                   	push   %ebx
c0104781:	83 ec 54             	sub    $0x54,%esp
    static int zone_num = 0;
    assert(n > 0 && zone_num < MAX_ZONE_NUM);
c0104784:	83 7d 0c 00          	cmpl   $0x0,0xc(%ebp)
c0104788:	74 0a                	je     c0104794 <buddy_init_memmap+0x17>
c010478a:	a1 e4 89 12 c0       	mov    0xc01289e4,%eax
c010478f:	83 f8 09             	cmp    $0x9,%eax
c0104792:	7e 24                	jle    c01047b8 <buddy_init_memmap+0x3b>
c0104794:	c7 44 24 0c 70 bd 10 	movl   $0xc010bd70,0xc(%esp)
c010479b:	c0 
c010479c:	c7 44 24 08 91 bd 10 	movl   $0xc010bd91,0x8(%esp)
c01047a3:	c0 
c01047a4:	c7 44 24 04 36 00 00 	movl   $0x36,0x4(%esp)
c01047ab:	00 
c01047ac:	c7 04 24 a6 bd 10 c0 	movl   $0xc010bda6,(%esp)
c01047b3:	e8 f8 e2 ff ff       	call   c0102ab0 <__panic>
    struct Page *p = base;
c01047b8:	8b 45 08             	mov    0x8(%ebp),%eax
c01047bb:	89 45 bc             	mov    %eax,-0x44(%ebp)
    for (; p != base + n; p ++) {
c01047be:	e9 89 00 00 00       	jmp    c010484c <buddy_init_memmap+0xcf>
        assert(PageReserved(p));
c01047c3:	8b 45 bc             	mov    -0x44(%ebp),%eax
c01047c6:	83 c0 04             	add    $0x4,%eax
c01047c9:	c7 45 cc 00 00 00 00 	movl   $0x0,-0x34(%ebp)
c01047d0:	89 45 c8             	mov    %eax,-0x38(%ebp)
 * @addr:   the address to count from
 * */
static inline bool
test_bit(int nr, volatile void *addr) {
    int oldbit;
    asm volatile ("btl %2, %1; sbbl %0,%0" : "=r" (oldbit) : "m" (*(volatile long *)addr), "Ir" (nr));
c01047d3:	8b 45 c8             	mov    -0x38(%ebp),%eax
c01047d6:	8b 55 cc             	mov    -0x34(%ebp),%edx
c01047d9:	0f a3 10             	bt     %edx,(%eax)
c01047dc:	19 c0                	sbb    %eax,%eax
c01047de:	89 45 d0             	mov    %eax,-0x30(%ebp)
    return oldbit != 0;
c01047e1:	83 7d d0 00          	cmpl   $0x0,-0x30(%ebp)
c01047e5:	0f 95 c0             	setne  %al
c01047e8:	0f b6 c0             	movzbl %al,%eax
c01047eb:	85 c0                	test   %eax,%eax
c01047ed:	75 24                	jne    c0104813 <buddy_init_memmap+0x96>
c01047ef:	c7 44 24 0c ba bd 10 	movl   $0xc010bdba,0xc(%esp)
c01047f6:	c0 
c01047f7:	c7 44 24 08 91 bd 10 	movl   $0xc010bd91,0x8(%esp)
c01047fe:	c0 
c01047ff:	c7 44 24 04 39 00 00 	movl   $0x39,0x4(%esp)
c0104806:	00 
c0104807:	c7 04 24 a6 bd 10 c0 	movl   $0xc010bda6,(%esp)
c010480e:	e8 9d e2 ff ff       	call   c0102ab0 <__panic>
        p->flags = p->property = 0;
c0104813:	8b 45 bc             	mov    -0x44(%ebp),%eax
c0104816:	c7 40 08 00 00 00 00 	movl   $0x0,0x8(%eax)
c010481d:	8b 45 bc             	mov    -0x44(%ebp),%eax
c0104820:	8b 50 08             	mov    0x8(%eax),%edx
c0104823:	8b 45 bc             	mov    -0x44(%ebp),%eax
c0104826:	89 50 04             	mov    %edx,0x4(%eax)
        p->zone_num = zone_num;
c0104829:	8b 15 e4 89 12 c0    	mov    0xc01289e4,%edx
c010482f:	8b 45 bc             	mov    -0x44(%ebp),%eax
c0104832:	89 50 0c             	mov    %edx,0xc(%eax)
        set_page_ref(p, 0);
c0104835:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
c010483c:	00 
c010483d:	8b 45 bc             	mov    -0x44(%ebp),%eax
c0104840:	89 04 24             	mov    %eax,(%esp)
c0104843:	e8 c0 fe ff ff       	call   c0104708 <set_page_ref>
static void
buddy_init_memmap(struct Page *base, size_t n) {
    static int zone_num = 0;
    assert(n > 0 && zone_num < MAX_ZONE_NUM);
    struct Page *p = base;
    for (; p != base + n; p ++) {
c0104848:	83 45 bc 18          	addl   $0x18,-0x44(%ebp)
c010484c:	8b 55 0c             	mov    0xc(%ebp),%edx
c010484f:	89 d0                	mov    %edx,%eax
c0104851:	01 c0                	add    %eax,%eax
c0104853:	01 d0                	add    %edx,%eax
c0104855:	c1 e0 03             	shl    $0x3,%eax
c0104858:	03 45 08             	add    0x8(%ebp),%eax
c010485b:	3b 45 bc             	cmp    -0x44(%ebp),%eax
c010485e:	0f 85 5f ff ff ff    	jne    c01047c3 <buddy_init_memmap+0x46>
        assert(PageReserved(p));
        p->flags = p->property = 0;
        p->zone_num = zone_num;
        set_page_ref(p, 0);
    }
    p = zones[zone_num ++].mem_base = base;
c0104864:	a1 e4 89 12 c0       	mov    0xc01289e4,%eax
c0104869:	8b 55 08             	mov    0x8(%ebp),%edx
c010486c:	89 14 85 20 89 12 c0 	mov    %edx,-0x3fed76e0(,%eax,4)
c0104873:	8b 14 85 20 89 12 c0 	mov    -0x3fed76e0(,%eax,4),%edx
c010487a:	89 55 bc             	mov    %edx,-0x44(%ebp)
c010487d:	83 c0 01             	add    $0x1,%eax
c0104880:	a3 e4 89 12 c0       	mov    %eax,0xc01289e4
    size_t order = MAX_ORDER, order_size = (1 << order);
c0104885:	c7 45 c0 0a 00 00 00 	movl   $0xa,-0x40(%ebp)
c010488c:	8b 45 c0             	mov    -0x40(%ebp),%eax
c010488f:	ba 01 00 00 00       	mov    $0x1,%edx
c0104894:	89 d3                	mov    %edx,%ebx
c0104896:	89 c1                	mov    %eax,%ecx
c0104898:	d3 e3                	shl    %cl,%ebx
c010489a:	89 d8                	mov    %ebx,%eax
c010489c:	89 45 c4             	mov    %eax,-0x3c(%ebp)
    while (n != 0) {
c010489f:	e9 d0 00 00 00       	jmp    c0104974 <buddy_init_memmap+0x1f7>
        while (n >= order_size) {
            p->property = order;
c01048a4:	8b 45 bc             	mov    -0x44(%ebp),%eax
c01048a7:	8b 55 c0             	mov    -0x40(%ebp),%edx
c01048aa:	89 50 08             	mov    %edx,0x8(%eax)
            SetPageProperty(p);
c01048ad:	8b 45 bc             	mov    -0x44(%ebp),%eax
c01048b0:	83 c0 04             	add    $0x4,%eax
c01048b3:	c7 45 d8 01 00 00 00 	movl   $0x1,-0x28(%ebp)
c01048ba:	89 45 d4             	mov    %eax,-0x2c(%ebp)
 * Note that @nr may be almost arbitrarily large; this function is not
 * restricted to acting on a single-word quantity.
 * */
static inline void
set_bit(int nr, volatile void *addr) {
    asm volatile ("btsl %1, %0" :"=m" (*(volatile long *)addr) : "Ir" (nr));
c01048bd:	8b 45 d4             	mov    -0x2c(%ebp),%eax
c01048c0:	8b 55 d8             	mov    -0x28(%ebp),%edx
c01048c3:	0f ab 10             	bts    %edx,(%eax)
            list_add(&free_list(order), &(p->page_link));
c01048c6:	8b 45 bc             	mov    -0x44(%ebp),%eax
c01048c9:	8d 48 10             	lea    0x10(%eax),%ecx
c01048cc:	8b 55 c0             	mov    -0x40(%ebp),%edx
c01048cf:	89 d0                	mov    %edx,%eax
c01048d1:	01 c0                	add    %eax,%eax
c01048d3:	01 d0                	add    %edx,%eax
c01048d5:	c1 e0 02             	shl    $0x2,%eax
c01048d8:	05 60 89 12 c0       	add    $0xc0128960,%eax
c01048dd:	89 45 e0             	mov    %eax,-0x20(%ebp)
c01048e0:	89 4d dc             	mov    %ecx,-0x24(%ebp)
c01048e3:	8b 45 e0             	mov    -0x20(%ebp),%eax
c01048e6:	89 45 e8             	mov    %eax,-0x18(%ebp)
c01048e9:	8b 45 dc             	mov    -0x24(%ebp),%eax
c01048ec:	89 45 e4             	mov    %eax,-0x1c(%ebp)
 * Insert the new element @elm *after* the element @listelm which
 * is already in the list.
 * */
static inline void
list_add_after(list_entry_t *listelm, list_entry_t *elm) {
    __list_add(elm, listelm, listelm->next);
c01048ef:	8b 45 e8             	mov    -0x18(%ebp),%eax
c01048f2:	8b 40 04             	mov    0x4(%eax),%eax
c01048f5:	8b 55 e4             	mov    -0x1c(%ebp),%edx
c01048f8:	89 55 f4             	mov    %edx,-0xc(%ebp)
c01048fb:	8b 55 e8             	mov    -0x18(%ebp),%edx
c01048fe:	89 55 f0             	mov    %edx,-0x10(%ebp)
c0104901:	89 45 ec             	mov    %eax,-0x14(%ebp)
 * This is only for internal list manipulation where we know
 * the prev/next entries already!
 * */
static inline void
__list_add(list_entry_t *elm, list_entry_t *prev, list_entry_t *next) {
    prev->next = next->prev = elm;
c0104904:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0104907:	8b 55 f4             	mov    -0xc(%ebp),%edx
c010490a:	89 10                	mov    %edx,(%eax)
c010490c:	8b 45 ec             	mov    -0x14(%ebp),%eax
c010490f:	8b 10                	mov    (%eax),%edx
c0104911:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0104914:	89 50 04             	mov    %edx,0x4(%eax)
    elm->next = next;
c0104917:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010491a:	8b 55 ec             	mov    -0x14(%ebp),%edx
c010491d:	89 50 04             	mov    %edx,0x4(%eax)
    elm->prev = prev;
c0104920:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0104923:	8b 55 f0             	mov    -0x10(%ebp),%edx
c0104926:	89 10                	mov    %edx,(%eax)
            n -= order_size, p += order_size;
c0104928:	8b 45 c4             	mov    -0x3c(%ebp),%eax
c010492b:	29 45 0c             	sub    %eax,0xc(%ebp)
c010492e:	8b 55 c4             	mov    -0x3c(%ebp),%edx
c0104931:	89 d0                	mov    %edx,%eax
c0104933:	01 c0                	add    %eax,%eax
c0104935:	01 d0                	add    %edx,%eax
c0104937:	c1 e0 03             	shl    $0x3,%eax
c010493a:	01 45 bc             	add    %eax,-0x44(%ebp)
            nr_free(order) ++;
c010493d:	8b 55 c0             	mov    -0x40(%ebp),%edx
c0104940:	89 d0                	mov    %edx,%eax
c0104942:	01 c0                	add    %eax,%eax
c0104944:	01 d0                	add    %edx,%eax
c0104946:	c1 e0 02             	shl    $0x2,%eax
c0104949:	8b 80 68 89 12 c0    	mov    -0x3fed7698(%eax),%eax
c010494f:	8d 48 01             	lea    0x1(%eax),%ecx
c0104952:	89 d0                	mov    %edx,%eax
c0104954:	01 c0                	add    %eax,%eax
c0104956:	01 d0                	add    %edx,%eax
c0104958:	c1 e0 02             	shl    $0x2,%eax
c010495b:	89 88 68 89 12 c0    	mov    %ecx,-0x3fed7698(%eax)
        set_page_ref(p, 0);
    }
    p = zones[zone_num ++].mem_base = base;
    size_t order = MAX_ORDER, order_size = (1 << order);
    while (n != 0) {
        while (n >= order_size) {
c0104961:	8b 45 0c             	mov    0xc(%ebp),%eax
c0104964:	3b 45 c4             	cmp    -0x3c(%ebp),%eax
c0104967:	0f 83 37 ff ff ff    	jae    c01048a4 <buddy_init_memmap+0x127>
            SetPageProperty(p);
            list_add(&free_list(order), &(p->page_link));
            n -= order_size, p += order_size;
            nr_free(order) ++;
        }
        order --;
c010496d:	83 6d c0 01          	subl   $0x1,-0x40(%ebp)
        order_size >>= 1;
c0104971:	d1 6d c4             	shrl   -0x3c(%ebp)
        p->zone_num = zone_num;
        set_page_ref(p, 0);
    }
    p = zones[zone_num ++].mem_base = base;
    size_t order = MAX_ORDER, order_size = (1 << order);
    while (n != 0) {
c0104974:	83 7d 0c 00          	cmpl   $0x0,0xc(%ebp)
c0104978:	75 e7                	jne    c0104961 <buddy_init_memmap+0x1e4>
            nr_free(order) ++;
        }
        order --;
        order_size >>= 1;
    }
}
c010497a:	83 c4 54             	add    $0x54,%esp
c010497d:	5b                   	pop    %ebx
c010497e:	5d                   	pop    %ebp
c010497f:	c3                   	ret    

c0104980 <getorder>:

//getorder - return order, the minmal 2^order >= n
static inline size_t
getorder(size_t n) {
c0104980:	55                   	push   %ebp
c0104981:	89 e5                	mov    %esp,%ebp
c0104983:	83 ec 28             	sub    $0x28,%esp
    size_t order, order_size;
    for (order = 0, order_size = 1; order <= MAX_ORDER; order ++, order_size <<= 1) {
c0104986:	c7 45 f0 00 00 00 00 	movl   $0x0,-0x10(%ebp)
c010498d:	c7 45 f4 01 00 00 00 	movl   $0x1,-0xc(%ebp)
c0104994:	eb 14                	jmp    c01049aa <getorder+0x2a>
        if (n <= order_size) {
c0104996:	8b 45 08             	mov    0x8(%ebp),%eax
c0104999:	3b 45 f4             	cmp    -0xc(%ebp),%eax
c010499c:	77 05                	ja     c01049a3 <getorder+0x23>
            return order;
c010499e:	8b 45 f0             	mov    -0x10(%ebp),%eax
        }
    }
    panic("getorder failed. %d\n", n);
}
c01049a1:	c9                   	leave  
c01049a2:	c3                   	ret    

//getorder - return order, the minmal 2^order >= n
static inline size_t
getorder(size_t n) {
    size_t order, order_size;
    for (order = 0, order_size = 1; order <= MAX_ORDER; order ++, order_size <<= 1) {
c01049a3:	83 45 f0 01          	addl   $0x1,-0x10(%ebp)
c01049a7:	d1 65 f4             	shll   -0xc(%ebp)
c01049aa:	83 7d f0 0a          	cmpl   $0xa,-0x10(%ebp)
c01049ae:	76 e6                	jbe    c0104996 <getorder+0x16>
        if (n <= order_size) {
            return order;
        }
    }
    panic("getorder failed. %d\n", n);
c01049b0:	8b 45 08             	mov    0x8(%ebp),%eax
c01049b3:	89 44 24 0c          	mov    %eax,0xc(%esp)
c01049b7:	c7 44 24 08 ca bd 10 	movl   $0xc010bdca,0x8(%esp)
c01049be:	c0 
c01049bf:	c7 44 24 04 56 00 00 	movl   $0x56,0x4(%esp)
c01049c6:	00 
c01049c7:	c7 04 24 a6 bd 10 c0 	movl   $0xc010bda6,(%esp)
c01049ce:	e8 dd e0 ff ff       	call   c0102ab0 <__panic>

c01049d3 <buddy_alloc_pages_sub>:
}

//buddy_alloc_pages_sub - the actual allocation implimentation, return a page whose size >=n,
//                      - the remaining free parts insert to other free list
static inline struct Page *
buddy_alloc_pages_sub(size_t order) {
c01049d3:	55                   	push   %ebp
c01049d4:	89 e5                	mov    %esp,%ebp
c01049d6:	53                   	push   %ebx
c01049d7:	83 ec 74             	sub    $0x74,%esp
    assert(order <= MAX_ORDER);
c01049da:	83 7d 08 0a          	cmpl   $0xa,0x8(%ebp)
c01049de:	76 24                	jbe    c0104a04 <buddy_alloc_pages_sub+0x31>
c01049e0:	c7 44 24 0c df bd 10 	movl   $0xc010bddf,0xc(%esp)
c01049e7:	c0 
c01049e8:	c7 44 24 08 91 bd 10 	movl   $0xc010bd91,0x8(%esp)
c01049ef:	c0 
c01049f0:	c7 44 24 04 5d 00 00 	movl   $0x5d,0x4(%esp)
c01049f7:	00 
c01049f8:	c7 04 24 a6 bd 10 c0 	movl   $0xc010bda6,(%esp)
c01049ff:	e8 ac e0 ff ff       	call   c0102ab0 <__panic>
    size_t cur_order;
    for (cur_order = order; cur_order <= MAX_ORDER; cur_order ++) {
c0104a04:	8b 45 08             	mov    0x8(%ebp),%eax
c0104a07:	89 45 a4             	mov    %eax,-0x5c(%ebp)
c0104a0a:	e9 a4 01 00 00       	jmp    c0104bb3 <buddy_alloc_pages_sub+0x1e0>
        if (!list_empty(&free_list(cur_order))) {
c0104a0f:	8b 55 a4             	mov    -0x5c(%ebp),%edx
c0104a12:	89 d0                	mov    %edx,%eax
c0104a14:	01 c0                	add    %eax,%eax
c0104a16:	01 d0                	add    %edx,%eax
c0104a18:	c1 e0 02             	shl    $0x2,%eax
c0104a1b:	05 60 89 12 c0       	add    $0xc0128960,%eax
c0104a20:	89 45 b8             	mov    %eax,-0x48(%ebp)
 * list_empty - tests whether a list is empty
 * @list:       the list to test.
 * */
static inline bool
list_empty(list_entry_t *list) {
    return list->next == list;
c0104a23:	8b 45 b8             	mov    -0x48(%ebp),%eax
c0104a26:	8b 40 04             	mov    0x4(%eax),%eax
c0104a29:	39 45 b8             	cmp    %eax,-0x48(%ebp)
c0104a2c:	0f 94 c0             	sete   %al
c0104a2f:	0f b6 c0             	movzbl %al,%eax
c0104a32:	85 c0                	test   %eax,%eax
c0104a34:	0f 85 75 01 00 00    	jne    c0104baf <buddy_alloc_pages_sub+0x1dc>
            list_entry_t *le = list_next(&free_list(cur_order));
c0104a3a:	8b 55 a4             	mov    -0x5c(%ebp),%edx
c0104a3d:	89 d0                	mov    %edx,%eax
c0104a3f:	01 c0                	add    %eax,%eax
c0104a41:	01 d0                	add    %edx,%eax
c0104a43:	c1 e0 02             	shl    $0x2,%eax
c0104a46:	05 60 89 12 c0       	add    $0xc0128960,%eax
c0104a4b:	89 45 bc             	mov    %eax,-0x44(%ebp)
 * list_next - get the next entry
 * @listelm:    the list head
 **/
static list_entry_t *
list_next(list_entry_t *listelm) {
    return listelm->next;
c0104a4e:	8b 45 bc             	mov    -0x44(%ebp),%eax
c0104a51:	8b 40 04             	mov    0x4(%eax),%eax
c0104a54:	89 45 a8             	mov    %eax,-0x58(%ebp)
            struct Page *page = le2page(le, page_link);
c0104a57:	8b 45 a8             	mov    -0x58(%ebp),%eax
c0104a5a:	83 e8 10             	sub    $0x10,%eax
c0104a5d:	89 45 ac             	mov    %eax,-0x54(%ebp)
            nr_free(cur_order) --;
c0104a60:	8b 55 a4             	mov    -0x5c(%ebp),%edx
c0104a63:	89 d0                	mov    %edx,%eax
c0104a65:	01 c0                	add    %eax,%eax
c0104a67:	01 d0                	add    %edx,%eax
c0104a69:	c1 e0 02             	shl    $0x2,%eax
c0104a6c:	8b 80 68 89 12 c0    	mov    -0x3fed7698(%eax),%eax
c0104a72:	8d 48 ff             	lea    -0x1(%eax),%ecx
c0104a75:	89 d0                	mov    %edx,%eax
c0104a77:	01 c0                	add    %eax,%eax
c0104a79:	01 d0                	add    %edx,%eax
c0104a7b:	c1 e0 02             	shl    $0x2,%eax
c0104a7e:	89 88 68 89 12 c0    	mov    %ecx,-0x3fed7698(%eax)
c0104a84:	8b 45 a8             	mov    -0x58(%ebp),%eax
c0104a87:	89 45 c0             	mov    %eax,-0x40(%ebp)
 * Note: list_empty() on @listelm does not return true after this, the entry is
 * in an undefined state.
 * */
static inline void
list_del(list_entry_t *listelm) {
    __list_del(listelm->prev, listelm->next);
c0104a8a:	8b 45 c0             	mov    -0x40(%ebp),%eax
c0104a8d:	8b 40 04             	mov    0x4(%eax),%eax
c0104a90:	8b 55 c0             	mov    -0x40(%ebp),%edx
c0104a93:	8b 12                	mov    (%edx),%edx
c0104a95:	89 55 c8             	mov    %edx,-0x38(%ebp)
c0104a98:	89 45 c4             	mov    %eax,-0x3c(%ebp)
 * This is only for internal list manipulation where we know
 * the prev/next entries already!
 * */
static inline void
__list_del(list_entry_t *prev, list_entry_t *next) {
    prev->next = next;
c0104a9b:	8b 45 c8             	mov    -0x38(%ebp),%eax
c0104a9e:	8b 55 c4             	mov    -0x3c(%ebp),%edx
c0104aa1:	89 50 04             	mov    %edx,0x4(%eax)
    next->prev = prev;
c0104aa4:	8b 45 c4             	mov    -0x3c(%ebp),%eax
c0104aa7:	8b 55 c8             	mov    -0x38(%ebp),%edx
c0104aaa:	89 10                	mov    %edx,(%eax)
            list_del(le);
            size_t size = 1 << cur_order;
c0104aac:	8b 45 a4             	mov    -0x5c(%ebp),%eax
c0104aaf:	ba 01 00 00 00       	mov    $0x1,%edx
c0104ab4:	89 d3                	mov    %edx,%ebx
c0104ab6:	89 c1                	mov    %eax,%ecx
c0104ab8:	d3 e3                	shl    %cl,%ebx
c0104aba:	89 d8                	mov    %ebx,%eax
c0104abc:	89 45 b0             	mov    %eax,-0x50(%ebp)
            while (cur_order > order) {
c0104abf:	e9 c1 00 00 00       	jmp    c0104b85 <buddy_alloc_pages_sub+0x1b2>
                cur_order --;
c0104ac4:	83 6d a4 01          	subl   $0x1,-0x5c(%ebp)
                size >>= 1;
c0104ac8:	d1 6d b0             	shrl   -0x50(%ebp)
                struct Page *buddy = page + size;
c0104acb:	8b 55 b0             	mov    -0x50(%ebp),%edx
c0104ace:	89 d0                	mov    %edx,%eax
c0104ad0:	01 c0                	add    %eax,%eax
c0104ad2:	01 d0                	add    %edx,%eax
c0104ad4:	c1 e0 03             	shl    $0x3,%eax
c0104ad7:	03 45 ac             	add    -0x54(%ebp),%eax
c0104ada:	89 45 b4             	mov    %eax,-0x4c(%ebp)
                buddy->property = cur_order;
c0104add:	8b 45 b4             	mov    -0x4c(%ebp),%eax
c0104ae0:	8b 55 a4             	mov    -0x5c(%ebp),%edx
c0104ae3:	89 50 08             	mov    %edx,0x8(%eax)
                SetPageProperty(buddy);
c0104ae6:	8b 45 b4             	mov    -0x4c(%ebp),%eax
c0104ae9:	83 c0 04             	add    $0x4,%eax
c0104aec:	c7 45 d0 01 00 00 00 	movl   $0x1,-0x30(%ebp)
c0104af3:	89 45 cc             	mov    %eax,-0x34(%ebp)
c0104af6:	8b 45 cc             	mov    -0x34(%ebp),%eax
c0104af9:	8b 55 d0             	mov    -0x30(%ebp),%edx
c0104afc:	0f ab 10             	bts    %edx,(%eax)
                nr_free(cur_order) ++;
c0104aff:	8b 55 a4             	mov    -0x5c(%ebp),%edx
c0104b02:	89 d0                	mov    %edx,%eax
c0104b04:	01 c0                	add    %eax,%eax
c0104b06:	01 d0                	add    %edx,%eax
c0104b08:	c1 e0 02             	shl    $0x2,%eax
c0104b0b:	8b 80 68 89 12 c0    	mov    -0x3fed7698(%eax),%eax
c0104b11:	8d 48 01             	lea    0x1(%eax),%ecx
c0104b14:	89 d0                	mov    %edx,%eax
c0104b16:	01 c0                	add    %eax,%eax
c0104b18:	01 d0                	add    %edx,%eax
c0104b1a:	c1 e0 02             	shl    $0x2,%eax
c0104b1d:	89 88 68 89 12 c0    	mov    %ecx,-0x3fed7698(%eax)
                list_add(&free_list(cur_order), &(buddy->page_link));
c0104b23:	8b 45 b4             	mov    -0x4c(%ebp),%eax
c0104b26:	8d 48 10             	lea    0x10(%eax),%ecx
c0104b29:	8b 55 a4             	mov    -0x5c(%ebp),%edx
c0104b2c:	89 d0                	mov    %edx,%eax
c0104b2e:	01 c0                	add    %eax,%eax
c0104b30:	01 d0                	add    %edx,%eax
c0104b32:	c1 e0 02             	shl    $0x2,%eax
c0104b35:	05 60 89 12 c0       	add    $0xc0128960,%eax
c0104b3a:	89 45 d8             	mov    %eax,-0x28(%ebp)
c0104b3d:	89 4d d4             	mov    %ecx,-0x2c(%ebp)
c0104b40:	8b 45 d8             	mov    -0x28(%ebp),%eax
c0104b43:	89 45 e0             	mov    %eax,-0x20(%ebp)
c0104b46:	8b 45 d4             	mov    -0x2c(%ebp),%eax
c0104b49:	89 45 dc             	mov    %eax,-0x24(%ebp)
 * Insert the new element @elm *after* the element @listelm which
 * is already in the list.
 * */
static inline void
list_add_after(list_entry_t *listelm, list_entry_t *elm) {
    __list_add(elm, listelm, listelm->next);
c0104b4c:	8b 45 e0             	mov    -0x20(%ebp),%eax
c0104b4f:	8b 40 04             	mov    0x4(%eax),%eax
c0104b52:	8b 55 dc             	mov    -0x24(%ebp),%edx
c0104b55:	89 55 ec             	mov    %edx,-0x14(%ebp)
c0104b58:	8b 55 e0             	mov    -0x20(%ebp),%edx
c0104b5b:	89 55 e8             	mov    %edx,-0x18(%ebp)
c0104b5e:	89 45 e4             	mov    %eax,-0x1c(%ebp)
 * This is only for internal list manipulation where we know
 * the prev/next entries already!
 * */
static inline void
__list_add(list_entry_t *elm, list_entry_t *prev, list_entry_t *next) {
    prev->next = next->prev = elm;
c0104b61:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0104b64:	8b 55 ec             	mov    -0x14(%ebp),%edx
c0104b67:	89 10                	mov    %edx,(%eax)
c0104b69:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0104b6c:	8b 10                	mov    (%eax),%edx
c0104b6e:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0104b71:	89 50 04             	mov    %edx,0x4(%eax)
    elm->next = next;
c0104b74:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0104b77:	8b 55 e4             	mov    -0x1c(%ebp),%edx
c0104b7a:	89 50 04             	mov    %edx,0x4(%eax)
    elm->prev = prev;
c0104b7d:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0104b80:	8b 55 e8             	mov    -0x18(%ebp),%edx
c0104b83:	89 10                	mov    %edx,(%eax)
            list_entry_t *le = list_next(&free_list(cur_order));
            struct Page *page = le2page(le, page_link);
            nr_free(cur_order) --;
            list_del(le);
            size_t size = 1 << cur_order;
            while (cur_order > order) {
c0104b85:	8b 45 a4             	mov    -0x5c(%ebp),%eax
c0104b88:	3b 45 08             	cmp    0x8(%ebp),%eax
c0104b8b:	0f 87 33 ff ff ff    	ja     c0104ac4 <buddy_alloc_pages_sub+0xf1>
                buddy->property = cur_order;
                SetPageProperty(buddy);
                nr_free(cur_order) ++;
                list_add(&free_list(cur_order), &(buddy->page_link));
            }
            ClearPageProperty(page);
c0104b91:	8b 45 ac             	mov    -0x54(%ebp),%eax
c0104b94:	83 c0 04             	add    $0x4,%eax
c0104b97:	c7 45 f4 01 00 00 00 	movl   $0x1,-0xc(%ebp)
c0104b9e:	89 45 f0             	mov    %eax,-0x10(%ebp)
 * @nr:     the bit to clear
 * @addr:   the address to start counting from
 * */
static inline void
clear_bit(int nr, volatile void *addr) {
    asm volatile ("btrl %1, %0" :"=m" (*(volatile long *)addr) : "Ir" (nr));
c0104ba1:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0104ba4:	8b 55 f4             	mov    -0xc(%ebp),%edx
c0104ba7:	0f b3 10             	btr    %edx,(%eax)
            return page;
c0104baa:	8b 45 ac             	mov    -0x54(%ebp),%eax
c0104bad:	eb 13                	jmp    c0104bc2 <buddy_alloc_pages_sub+0x1ef>
//                      - the remaining free parts insert to other free list
static inline struct Page *
buddy_alloc_pages_sub(size_t order) {
    assert(order <= MAX_ORDER);
    size_t cur_order;
    for (cur_order = order; cur_order <= MAX_ORDER; cur_order ++) {
c0104baf:	83 45 a4 01          	addl   $0x1,-0x5c(%ebp)
c0104bb3:	83 7d a4 0a          	cmpl   $0xa,-0x5c(%ebp)
c0104bb7:	0f 86 52 fe ff ff    	jbe    c0104a0f <buddy_alloc_pages_sub+0x3c>
            }
            ClearPageProperty(page);
            return page;
        }
    }
    return NULL;
c0104bbd:	b8 00 00 00 00       	mov    $0x0,%eax
}
c0104bc2:	83 c4 74             	add    $0x74,%esp
c0104bc5:	5b                   	pop    %ebx
c0104bc6:	5d                   	pop    %ebp
c0104bc7:	c3                   	ret    

c0104bc8 <buddy_alloc_pages>:

//buddy_alloc_pages - call buddy_alloc_pages_sub to alloc 2^order>=n pages
static struct Page *
buddy_alloc_pages(size_t n) {
c0104bc8:	55                   	push   %ebp
c0104bc9:	89 e5                	mov    %esp,%ebp
c0104bcb:	53                   	push   %ebx
c0104bcc:	83 ec 24             	sub    $0x24,%esp
    assert(n > 0);
c0104bcf:	83 7d 08 00          	cmpl   $0x0,0x8(%ebp)
c0104bd3:	75 24                	jne    c0104bf9 <buddy_alloc_pages+0x31>
c0104bd5:	c7 44 24 0c f2 bd 10 	movl   $0xc010bdf2,0xc(%esp)
c0104bdc:	c0 
c0104bdd:	c7 44 24 08 91 bd 10 	movl   $0xc010bd91,0x8(%esp)
c0104be4:	c0 
c0104be5:	c7 44 24 04 79 00 00 	movl   $0x79,0x4(%esp)
c0104bec:	00 
c0104bed:	c7 04 24 a6 bd 10 c0 	movl   $0xc010bda6,(%esp)
c0104bf4:	e8 b7 de ff ff       	call   c0102ab0 <__panic>
    size_t order = getorder(n), order_size = (1 << order);
c0104bf9:	8b 45 08             	mov    0x8(%ebp),%eax
c0104bfc:	89 04 24             	mov    %eax,(%esp)
c0104bff:	e8 7c fd ff ff       	call   c0104980 <getorder>
c0104c04:	89 45 ec             	mov    %eax,-0x14(%ebp)
c0104c07:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0104c0a:	ba 01 00 00 00       	mov    $0x1,%edx
c0104c0f:	89 d3                	mov    %edx,%ebx
c0104c11:	89 c1                	mov    %eax,%ecx
c0104c13:	d3 e3                	shl    %cl,%ebx
c0104c15:	89 d8                	mov    %ebx,%eax
c0104c17:	89 45 f0             	mov    %eax,-0x10(%ebp)
    struct Page *page = buddy_alloc_pages_sub(order);
c0104c1a:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0104c1d:	89 04 24             	mov    %eax,(%esp)
c0104c20:	e8 ae fd ff ff       	call   c01049d3 <buddy_alloc_pages_sub>
c0104c25:	89 45 f4             	mov    %eax,-0xc(%ebp)
    if (page != NULL && n != order_size) {
c0104c28:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c0104c2c:	74 2d                	je     c0104c5b <buddy_alloc_pages+0x93>
c0104c2e:	8b 45 08             	mov    0x8(%ebp),%eax
c0104c31:	3b 45 f0             	cmp    -0x10(%ebp),%eax
c0104c34:	74 25                	je     c0104c5b <buddy_alloc_pages+0x93>
        free_pages(page + n, order_size - n);
c0104c36:	8b 45 08             	mov    0x8(%ebp),%eax
c0104c39:	8b 55 f0             	mov    -0x10(%ebp),%edx
c0104c3c:	89 d1                	mov    %edx,%ecx
c0104c3e:	29 c1                	sub    %eax,%ecx
c0104c40:	8b 55 08             	mov    0x8(%ebp),%edx
c0104c43:	89 d0                	mov    %edx,%eax
c0104c45:	01 c0                	add    %eax,%eax
c0104c47:	01 d0                	add    %edx,%eax
c0104c49:	c1 e0 03             	shl    $0x3,%eax
c0104c4c:	03 45 f4             	add    -0xc(%ebp),%eax
c0104c4f:	89 4c 24 04          	mov    %ecx,0x4(%esp)
c0104c53:	89 04 24             	mov    %eax,(%esp)
c0104c56:	e8 a4 13 00 00       	call   c0105fff <free_pages>
    }
    return page;
c0104c5b:	8b 45 f4             	mov    -0xc(%ebp),%eax
}
c0104c5e:	83 c4 24             	add    $0x24,%esp
c0104c61:	5b                   	pop    %ebx
c0104c62:	5d                   	pop    %ebp
c0104c63:	c3                   	ret    

c0104c64 <page_is_buddy>:

//page_is_buddy - Does this page belong to the No. zone_num Zone & this page
//              -  be in the continuous page block whose size is 2^order pages?
static inline bool
page_is_buddy(struct Page *page, size_t order, int zone_num) {
c0104c64:	55                   	push   %ebp
c0104c65:	89 e5                	mov    %esp,%ebp
c0104c67:	83 ec 24             	sub    $0x24,%esp
    if (page2ppn(page) < npage) {
c0104c6a:	8b 45 08             	mov    0x8(%ebp),%eax
c0104c6d:	89 04 24             	mov    %eax,(%esp)
c0104c70:	e8 77 fa ff ff       	call   c01046ec <page2ppn>
c0104c75:	8b 15 00 8a 12 c0    	mov    0xc0128a00,%edx
c0104c7b:	39 d0                	cmp    %edx,%eax
c0104c7d:	73 7c                	jae    c0104cfb <page_is_buddy+0x97>
        if (page->zone_num == zone_num) {
c0104c7f:	8b 45 08             	mov    0x8(%ebp),%eax
c0104c82:	8b 40 0c             	mov    0xc(%eax),%eax
c0104c85:	3b 45 10             	cmp    0x10(%ebp),%eax
c0104c88:	75 71                	jne    c0104cfb <page_is_buddy+0x97>
            return !PageReserved(page) && PageProperty(page) && page->property == order;
c0104c8a:	8b 45 08             	mov    0x8(%ebp),%eax
c0104c8d:	83 c0 04             	add    $0x4,%eax
c0104c90:	c7 45 ec 00 00 00 00 	movl   $0x0,-0x14(%ebp)
c0104c97:	89 45 e8             	mov    %eax,-0x18(%ebp)
 * @addr:   the address to count from
 * */
static inline bool
test_bit(int nr, volatile void *addr) {
    int oldbit;
    asm volatile ("btl %2, %1; sbbl %0,%0" : "=r" (oldbit) : "m" (*(volatile long *)addr), "Ir" (nr));
c0104c9a:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0104c9d:	8b 55 ec             	mov    -0x14(%ebp),%edx
c0104ca0:	0f a3 10             	bt     %edx,(%eax)
c0104ca3:	19 c0                	sbb    %eax,%eax
c0104ca5:	89 45 f0             	mov    %eax,-0x10(%ebp)
    return oldbit != 0;
c0104ca8:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
c0104cac:	0f 95 c0             	setne  %al
c0104caf:	0f b6 c0             	movzbl %al,%eax
c0104cb2:	85 c0                	test   %eax,%eax
c0104cb4:	75 3e                	jne    c0104cf4 <page_is_buddy+0x90>
c0104cb6:	8b 45 08             	mov    0x8(%ebp),%eax
c0104cb9:	83 c0 04             	add    $0x4,%eax
c0104cbc:	c7 45 f8 01 00 00 00 	movl   $0x1,-0x8(%ebp)
c0104cc3:	89 45 f4             	mov    %eax,-0xc(%ebp)
 * @addr:   the address to count from
 * */
static inline bool
test_bit(int nr, volatile void *addr) {
    int oldbit;
    asm volatile ("btl %2, %1; sbbl %0,%0" : "=r" (oldbit) : "m" (*(volatile long *)addr), "Ir" (nr));
c0104cc6:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0104cc9:	8b 55 f8             	mov    -0x8(%ebp),%edx
c0104ccc:	0f a3 10             	bt     %edx,(%eax)
c0104ccf:	19 c0                	sbb    %eax,%eax
c0104cd1:	89 45 fc             	mov    %eax,-0x4(%ebp)
    return oldbit != 0;
c0104cd4:	83 7d fc 00          	cmpl   $0x0,-0x4(%ebp)
c0104cd8:	0f 95 c0             	setne  %al
c0104cdb:	0f b6 c0             	movzbl %al,%eax
c0104cde:	85 c0                	test   %eax,%eax
c0104ce0:	74 12                	je     c0104cf4 <page_is_buddy+0x90>
c0104ce2:	8b 45 08             	mov    0x8(%ebp),%eax
c0104ce5:	8b 40 08             	mov    0x8(%eax),%eax
c0104ce8:	3b 45 0c             	cmp    0xc(%ebp),%eax
c0104ceb:	75 07                	jne    c0104cf4 <page_is_buddy+0x90>
c0104ced:	b8 01 00 00 00       	mov    $0x1,%eax
c0104cf2:	eb 05                	jmp    c0104cf9 <page_is_buddy+0x95>
c0104cf4:	b8 00 00 00 00       	mov    $0x0,%eax
c0104cf9:	eb 05                	jmp    c0104d00 <page_is_buddy+0x9c>
        }
    }
    return 0;
c0104cfb:	b8 00 00 00 00       	mov    $0x0,%eax
}
c0104d00:	c9                   	leave  
c0104d01:	c3                   	ret    

c0104d02 <page2idx>:

//page2idx - get the related index number idx of continuous page block which this page belongs to 
static inline ppn_t
page2idx(struct Page *page) {
c0104d02:	55                   	push   %ebp
c0104d03:	89 e5                	mov    %esp,%ebp
    return page - zones[page->zone_num].mem_base;
c0104d05:	8b 55 08             	mov    0x8(%ebp),%edx
c0104d08:	8b 45 08             	mov    0x8(%ebp),%eax
c0104d0b:	8b 40 0c             	mov    0xc(%eax),%eax
c0104d0e:	8b 04 85 20 89 12 c0 	mov    -0x3fed76e0(,%eax,4),%eax
c0104d15:	89 d1                	mov    %edx,%ecx
c0104d17:	29 c1                	sub    %eax,%ecx
c0104d19:	89 c8                	mov    %ecx,%eax
c0104d1b:	c1 f8 03             	sar    $0x3,%eax
c0104d1e:	69 c0 ab aa aa aa    	imul   $0xaaaaaaab,%eax,%eax
}
c0104d24:	5d                   	pop    %ebp
c0104d25:	c3                   	ret    

c0104d26 <idx2page>:

//idx2page - get the related page according to the index number idx of continuous page block
static inline struct Page *
idx2page(int zone_num, ppn_t idx) {
c0104d26:	55                   	push   %ebp
c0104d27:	89 e5                	mov    %esp,%ebp
    return zones[zone_num].mem_base + idx;
c0104d29:	8b 45 08             	mov    0x8(%ebp),%eax
c0104d2c:	8b 0c 85 20 89 12 c0 	mov    -0x3fed76e0(,%eax,4),%ecx
c0104d33:	8b 55 0c             	mov    0xc(%ebp),%edx
c0104d36:	89 d0                	mov    %edx,%eax
c0104d38:	01 c0                	add    %eax,%eax
c0104d3a:	01 d0                	add    %edx,%eax
c0104d3c:	c1 e0 03             	shl    $0x3,%eax
c0104d3f:	8d 04 01             	lea    (%ecx,%eax,1),%eax
}
c0104d42:	5d                   	pop    %ebp
c0104d43:	c3                   	ret    

c0104d44 <buddy_free_pages_sub>:

//buddy_free_pages_sub - the actual free implimentation, should consider how to 
//                     - merge the adjacent buddy block
static void
buddy_free_pages_sub(struct Page *base, size_t order) {
c0104d44:	55                   	push   %ebp
c0104d45:	89 e5                	mov    %esp,%ebp
c0104d47:	53                   	push   %ebx
c0104d48:	81 ec 84 00 00 00    	sub    $0x84,%esp
    ppn_t buddy_idx, page_idx = page2idx(base);
c0104d4e:	8b 45 08             	mov    0x8(%ebp),%eax
c0104d51:	89 04 24             	mov    %eax,(%esp)
c0104d54:	e8 a9 ff ff ff       	call   c0104d02 <page2idx>
c0104d59:	89 45 94             	mov    %eax,-0x6c(%ebp)
    assert((page_idx & ((1 << order) - 1)) == 0);
c0104d5c:	8b 45 0c             	mov    0xc(%ebp),%eax
c0104d5f:	ba 01 00 00 00       	mov    $0x1,%edx
c0104d64:	89 d3                	mov    %edx,%ebx
c0104d66:	89 c1                	mov    %eax,%ecx
c0104d68:	d3 e3                	shl    %cl,%ebx
c0104d6a:	89 d8                	mov    %ebx,%eax
c0104d6c:	83 e8 01             	sub    $0x1,%eax
c0104d6f:	23 45 94             	and    -0x6c(%ebp),%eax
c0104d72:	85 c0                	test   %eax,%eax
c0104d74:	74 24                	je     c0104d9a <buddy_free_pages_sub+0x56>
c0104d76:	c7 44 24 0c f8 bd 10 	movl   $0xc010bdf8,0xc(%esp)
c0104d7d:	c0 
c0104d7e:	c7 44 24 08 91 bd 10 	movl   $0xc010bd91,0x8(%esp)
c0104d85:	c0 
c0104d86:	c7 44 24 04 9f 00 00 	movl   $0x9f,0x4(%esp)
c0104d8d:	00 
c0104d8e:	c7 04 24 a6 bd 10 c0 	movl   $0xc010bda6,(%esp)
c0104d95:	e8 16 dd ff ff       	call   c0102ab0 <__panic>
    struct Page *p = base;
c0104d9a:	8b 45 08             	mov    0x8(%ebp),%eax
c0104d9d:	89 45 98             	mov    %eax,-0x68(%ebp)
    for (; p != base + (1 << order); p ++) {
c0104da0:	e9 9d 00 00 00       	jmp    c0104e42 <buddy_free_pages_sub+0xfe>
        assert(!PageReserved(p) && !PageProperty(p));
c0104da5:	8b 45 98             	mov    -0x68(%ebp),%eax
c0104da8:	83 c0 04             	add    $0x4,%eax
c0104dab:	c7 45 ac 00 00 00 00 	movl   $0x0,-0x54(%ebp)
c0104db2:	89 45 a8             	mov    %eax,-0x58(%ebp)
 * @addr:   the address to count from
 * */
static inline bool
test_bit(int nr, volatile void *addr) {
    int oldbit;
    asm volatile ("btl %2, %1; sbbl %0,%0" : "=r" (oldbit) : "m" (*(volatile long *)addr), "Ir" (nr));
c0104db5:	8b 45 a8             	mov    -0x58(%ebp),%eax
c0104db8:	8b 55 ac             	mov    -0x54(%ebp),%edx
c0104dbb:	0f a3 10             	bt     %edx,(%eax)
c0104dbe:	19 c0                	sbb    %eax,%eax
c0104dc0:	89 45 b0             	mov    %eax,-0x50(%ebp)
    return oldbit != 0;
c0104dc3:	83 7d b0 00          	cmpl   $0x0,-0x50(%ebp)
c0104dc7:	0f 95 c0             	setne  %al
c0104dca:	0f b6 c0             	movzbl %al,%eax
c0104dcd:	85 c0                	test   %eax,%eax
c0104dcf:	75 2c                	jne    c0104dfd <buddy_free_pages_sub+0xb9>
c0104dd1:	8b 45 98             	mov    -0x68(%ebp),%eax
c0104dd4:	83 c0 04             	add    $0x4,%eax
c0104dd7:	c7 45 b8 01 00 00 00 	movl   $0x1,-0x48(%ebp)
c0104dde:	89 45 b4             	mov    %eax,-0x4c(%ebp)
 * @addr:   the address to count from
 * */
static inline bool
test_bit(int nr, volatile void *addr) {
    int oldbit;
    asm volatile ("btl %2, %1; sbbl %0,%0" : "=r" (oldbit) : "m" (*(volatile long *)addr), "Ir" (nr));
c0104de1:	8b 45 b4             	mov    -0x4c(%ebp),%eax
c0104de4:	8b 55 b8             	mov    -0x48(%ebp),%edx
c0104de7:	0f a3 10             	bt     %edx,(%eax)
c0104dea:	19 c0                	sbb    %eax,%eax
c0104dec:	89 45 bc             	mov    %eax,-0x44(%ebp)
    return oldbit != 0;
c0104def:	83 7d bc 00          	cmpl   $0x0,-0x44(%ebp)
c0104df3:	0f 95 c0             	setne  %al
c0104df6:	0f b6 c0             	movzbl %al,%eax
c0104df9:	85 c0                	test   %eax,%eax
c0104dfb:	74 24                	je     c0104e21 <buddy_free_pages_sub+0xdd>
c0104dfd:	c7 44 24 0c 20 be 10 	movl   $0xc010be20,0xc(%esp)
c0104e04:	c0 
c0104e05:	c7 44 24 08 91 bd 10 	movl   $0xc010bd91,0x8(%esp)
c0104e0c:	c0 
c0104e0d:	c7 44 24 04 a2 00 00 	movl   $0xa2,0x4(%esp)
c0104e14:	00 
c0104e15:	c7 04 24 a6 bd 10 c0 	movl   $0xc010bda6,(%esp)
c0104e1c:	e8 8f dc ff ff       	call   c0102ab0 <__panic>
        p->flags = 0;
c0104e21:	8b 45 98             	mov    -0x68(%ebp),%eax
c0104e24:	c7 40 04 00 00 00 00 	movl   $0x0,0x4(%eax)
        set_page_ref(p, 0);
c0104e2b:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
c0104e32:	00 
c0104e33:	8b 45 98             	mov    -0x68(%ebp),%eax
c0104e36:	89 04 24             	mov    %eax,(%esp)
c0104e39:	e8 ca f8 ff ff       	call   c0104708 <set_page_ref>
static void
buddy_free_pages_sub(struct Page *base, size_t order) {
    ppn_t buddy_idx, page_idx = page2idx(base);
    assert((page_idx & ((1 << order) - 1)) == 0);
    struct Page *p = base;
    for (; p != base + (1 << order); p ++) {
c0104e3e:	83 45 98 18          	addl   $0x18,-0x68(%ebp)
c0104e42:	8b 45 0c             	mov    0xc(%ebp),%eax
c0104e45:	ba 18 00 00 00       	mov    $0x18,%edx
c0104e4a:	89 d3                	mov    %edx,%ebx
c0104e4c:	89 c1                	mov    %eax,%ecx
c0104e4e:	d3 e3                	shl    %cl,%ebx
c0104e50:	89 d8                	mov    %ebx,%eax
c0104e52:	03 45 08             	add    0x8(%ebp),%eax
c0104e55:	3b 45 98             	cmp    -0x68(%ebp),%eax
c0104e58:	0f 85 47 ff ff ff    	jne    c0104da5 <buddy_free_pages_sub+0x61>
        assert(!PageReserved(p) && !PageProperty(p));
        p->flags = 0;
        set_page_ref(p, 0);
    }
    int zone_num = base->zone_num;
c0104e5e:	8b 45 08             	mov    0x8(%ebp),%eax
c0104e61:	8b 40 0c             	mov    0xc(%eax),%eax
c0104e64:	89 45 9c             	mov    %eax,-0x64(%ebp)
    while (order < MAX_ORDER) {
c0104e67:	e9 ba 00 00 00       	jmp    c0104f26 <buddy_free_pages_sub+0x1e2>
        buddy_idx = page_idx ^ (1 << order);
c0104e6c:	8b 45 0c             	mov    0xc(%ebp),%eax
c0104e6f:	ba 01 00 00 00       	mov    $0x1,%edx
c0104e74:	89 d3                	mov    %edx,%ebx
c0104e76:	89 c1                	mov    %eax,%ecx
c0104e78:	d3 e3                	shl    %cl,%ebx
c0104e7a:	89 d8                	mov    %ebx,%eax
c0104e7c:	33 45 94             	xor    -0x6c(%ebp),%eax
c0104e7f:	89 45 90             	mov    %eax,-0x70(%ebp)
        struct Page *buddy = idx2page(zone_num, buddy_idx);
c0104e82:	8b 45 90             	mov    -0x70(%ebp),%eax
c0104e85:	89 44 24 04          	mov    %eax,0x4(%esp)
c0104e89:	8b 45 9c             	mov    -0x64(%ebp),%eax
c0104e8c:	89 04 24             	mov    %eax,(%esp)
c0104e8f:	e8 92 fe ff ff       	call   c0104d26 <idx2page>
c0104e94:	89 45 a4             	mov    %eax,-0x5c(%ebp)
        if (!page_is_buddy(buddy, order, zone_num)) {
c0104e97:	8b 45 9c             	mov    -0x64(%ebp),%eax
c0104e9a:	89 44 24 08          	mov    %eax,0x8(%esp)
c0104e9e:	8b 45 0c             	mov    0xc(%ebp),%eax
c0104ea1:	89 44 24 04          	mov    %eax,0x4(%esp)
c0104ea5:	8b 45 a4             	mov    -0x5c(%ebp),%eax
c0104ea8:	89 04 24             	mov    %eax,(%esp)
c0104eab:	e8 b4 fd ff ff       	call   c0104c64 <page_is_buddy>
c0104eb0:	85 c0                	test   %eax,%eax
c0104eb2:	74 7e                	je     c0104f32 <buddy_free_pages_sub+0x1ee>
            break;
        }
        nr_free(order) --;
c0104eb4:	8b 55 0c             	mov    0xc(%ebp),%edx
c0104eb7:	89 d0                	mov    %edx,%eax
c0104eb9:	01 c0                	add    %eax,%eax
c0104ebb:	01 d0                	add    %edx,%eax
c0104ebd:	c1 e0 02             	shl    $0x2,%eax
c0104ec0:	8b 80 68 89 12 c0    	mov    -0x3fed7698(%eax),%eax
c0104ec6:	8d 48 ff             	lea    -0x1(%eax),%ecx
c0104ec9:	89 d0                	mov    %edx,%eax
c0104ecb:	01 c0                	add    %eax,%eax
c0104ecd:	01 d0                	add    %edx,%eax
c0104ecf:	c1 e0 02             	shl    $0x2,%eax
c0104ed2:	89 88 68 89 12 c0    	mov    %ecx,-0x3fed7698(%eax)
        list_del(&(buddy->page_link));
c0104ed8:	8b 45 a4             	mov    -0x5c(%ebp),%eax
c0104edb:	83 c0 10             	add    $0x10,%eax
c0104ede:	89 45 c0             	mov    %eax,-0x40(%ebp)
 * Note: list_empty() on @listelm does not return true after this, the entry is
 * in an undefined state.
 * */
static inline void
list_del(list_entry_t *listelm) {
    __list_del(listelm->prev, listelm->next);
c0104ee1:	8b 45 c0             	mov    -0x40(%ebp),%eax
c0104ee4:	8b 40 04             	mov    0x4(%eax),%eax
c0104ee7:	8b 55 c0             	mov    -0x40(%ebp),%edx
c0104eea:	8b 12                	mov    (%edx),%edx
c0104eec:	89 55 c8             	mov    %edx,-0x38(%ebp)
c0104eef:	89 45 c4             	mov    %eax,-0x3c(%ebp)
 * This is only for internal list manipulation where we know
 * the prev/next entries already!
 * */
static inline void
__list_del(list_entry_t *prev, list_entry_t *next) {
    prev->next = next;
c0104ef2:	8b 45 c8             	mov    -0x38(%ebp),%eax
c0104ef5:	8b 55 c4             	mov    -0x3c(%ebp),%edx
c0104ef8:	89 50 04             	mov    %edx,0x4(%eax)
    next->prev = prev;
c0104efb:	8b 45 c4             	mov    -0x3c(%ebp),%eax
c0104efe:	8b 55 c8             	mov    -0x38(%ebp),%edx
c0104f01:	89 10                	mov    %edx,(%eax)
        ClearPageProperty(buddy);
c0104f03:	8b 45 a4             	mov    -0x5c(%ebp),%eax
c0104f06:	83 c0 04             	add    $0x4,%eax
c0104f09:	c7 45 d0 01 00 00 00 	movl   $0x1,-0x30(%ebp)
c0104f10:	89 45 cc             	mov    %eax,-0x34(%ebp)
 * @nr:     the bit to clear
 * @addr:   the address to start counting from
 * */
static inline void
clear_bit(int nr, volatile void *addr) {
    asm volatile ("btrl %1, %0" :"=m" (*(volatile long *)addr) : "Ir" (nr));
c0104f13:	8b 45 cc             	mov    -0x34(%ebp),%eax
c0104f16:	8b 55 d0             	mov    -0x30(%ebp),%edx
c0104f19:	0f b3 10             	btr    %edx,(%eax)
        page_idx &= buddy_idx;
c0104f1c:	8b 45 90             	mov    -0x70(%ebp),%eax
c0104f1f:	21 45 94             	and    %eax,-0x6c(%ebp)
        order ++;
c0104f22:	83 45 0c 01          	addl   $0x1,0xc(%ebp)
        assert(!PageReserved(p) && !PageProperty(p));
        p->flags = 0;
        set_page_ref(p, 0);
    }
    int zone_num = base->zone_num;
    while (order < MAX_ORDER) {
c0104f26:	83 7d 0c 09          	cmpl   $0x9,0xc(%ebp)
c0104f2a:	0f 86 3c ff ff ff    	jbe    c0104e6c <buddy_free_pages_sub+0x128>
c0104f30:	eb 01                	jmp    c0104f33 <buddy_free_pages_sub+0x1ef>
        buddy_idx = page_idx ^ (1 << order);
        struct Page *buddy = idx2page(zone_num, buddy_idx);
        if (!page_is_buddy(buddy, order, zone_num)) {
            break;
c0104f32:	90                   	nop
        list_del(&(buddy->page_link));
        ClearPageProperty(buddy);
        page_idx &= buddy_idx;
        order ++;
    }
    struct Page *page = idx2page(zone_num, page_idx);
c0104f33:	8b 45 94             	mov    -0x6c(%ebp),%eax
c0104f36:	89 44 24 04          	mov    %eax,0x4(%esp)
c0104f3a:	8b 45 9c             	mov    -0x64(%ebp),%eax
c0104f3d:	89 04 24             	mov    %eax,(%esp)
c0104f40:	e8 e1 fd ff ff       	call   c0104d26 <idx2page>
c0104f45:	89 45 a0             	mov    %eax,-0x60(%ebp)
    page->property = order;
c0104f48:	8b 45 a0             	mov    -0x60(%ebp),%eax
c0104f4b:	8b 55 0c             	mov    0xc(%ebp),%edx
c0104f4e:	89 50 08             	mov    %edx,0x8(%eax)
    SetPageProperty(page);
c0104f51:	8b 45 a0             	mov    -0x60(%ebp),%eax
c0104f54:	83 c0 04             	add    $0x4,%eax
c0104f57:	c7 45 d8 01 00 00 00 	movl   $0x1,-0x28(%ebp)
c0104f5e:	89 45 d4             	mov    %eax,-0x2c(%ebp)
 * Note that @nr may be almost arbitrarily large; this function is not
 * restricted to acting on a single-word quantity.
 * */
static inline void
set_bit(int nr, volatile void *addr) {
    asm volatile ("btsl %1, %0" :"=m" (*(volatile long *)addr) : "Ir" (nr));
c0104f61:	8b 45 d4             	mov    -0x2c(%ebp),%eax
c0104f64:	8b 55 d8             	mov    -0x28(%ebp),%edx
c0104f67:	0f ab 10             	bts    %edx,(%eax)
    nr_free(order) ++;
c0104f6a:	8b 55 0c             	mov    0xc(%ebp),%edx
c0104f6d:	89 d0                	mov    %edx,%eax
c0104f6f:	01 c0                	add    %eax,%eax
c0104f71:	01 d0                	add    %edx,%eax
c0104f73:	c1 e0 02             	shl    $0x2,%eax
c0104f76:	8b 80 68 89 12 c0    	mov    -0x3fed7698(%eax),%eax
c0104f7c:	8d 48 01             	lea    0x1(%eax),%ecx
c0104f7f:	89 d0                	mov    %edx,%eax
c0104f81:	01 c0                	add    %eax,%eax
c0104f83:	01 d0                	add    %edx,%eax
c0104f85:	c1 e0 02             	shl    $0x2,%eax
c0104f88:	89 88 68 89 12 c0    	mov    %ecx,-0x3fed7698(%eax)
    list_add(&free_list(order), &(page->page_link));
c0104f8e:	8b 45 a0             	mov    -0x60(%ebp),%eax
c0104f91:	8d 48 10             	lea    0x10(%eax),%ecx
c0104f94:	8b 55 0c             	mov    0xc(%ebp),%edx
c0104f97:	89 d0                	mov    %edx,%eax
c0104f99:	01 c0                	add    %eax,%eax
c0104f9b:	01 d0                	add    %edx,%eax
c0104f9d:	c1 e0 02             	shl    $0x2,%eax
c0104fa0:	05 60 89 12 c0       	add    $0xc0128960,%eax
c0104fa5:	89 45 e0             	mov    %eax,-0x20(%ebp)
c0104fa8:	89 4d dc             	mov    %ecx,-0x24(%ebp)
c0104fab:	8b 45 e0             	mov    -0x20(%ebp),%eax
c0104fae:	89 45 e8             	mov    %eax,-0x18(%ebp)
c0104fb1:	8b 45 dc             	mov    -0x24(%ebp),%eax
c0104fb4:	89 45 e4             	mov    %eax,-0x1c(%ebp)
 * Insert the new element @elm *after* the element @listelm which
 * is already in the list.
 * */
static inline void
list_add_after(list_entry_t *listelm, list_entry_t *elm) {
    __list_add(elm, listelm, listelm->next);
c0104fb7:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0104fba:	8b 40 04             	mov    0x4(%eax),%eax
c0104fbd:	8b 55 e4             	mov    -0x1c(%ebp),%edx
c0104fc0:	89 55 f4             	mov    %edx,-0xc(%ebp)
c0104fc3:	8b 55 e8             	mov    -0x18(%ebp),%edx
c0104fc6:	89 55 f0             	mov    %edx,-0x10(%ebp)
c0104fc9:	89 45 ec             	mov    %eax,-0x14(%ebp)
 * This is only for internal list manipulation where we know
 * the prev/next entries already!
 * */
static inline void
__list_add(list_entry_t *elm, list_entry_t *prev, list_entry_t *next) {
    prev->next = next->prev = elm;
c0104fcc:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0104fcf:	8b 55 f4             	mov    -0xc(%ebp),%edx
c0104fd2:	89 10                	mov    %edx,(%eax)
c0104fd4:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0104fd7:	8b 10                	mov    (%eax),%edx
c0104fd9:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0104fdc:	89 50 04             	mov    %edx,0x4(%eax)
    elm->next = next;
c0104fdf:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0104fe2:	8b 55 ec             	mov    -0x14(%ebp),%edx
c0104fe5:	89 50 04             	mov    %edx,0x4(%eax)
    elm->prev = prev;
c0104fe8:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0104feb:	8b 55 f0             	mov    -0x10(%ebp),%edx
c0104fee:	89 10                	mov    %edx,(%eax)
}
c0104ff0:	81 c4 84 00 00 00    	add    $0x84,%esp
c0104ff6:	5b                   	pop    %ebx
c0104ff7:	5d                   	pop    %ebp
c0104ff8:	c3                   	ret    

c0104ff9 <buddy_free_pages>:

//buddy_free_pages - call buddy_free_pages_sub to free n continuous page block
static void
buddy_free_pages(struct Page *base, size_t n) {
c0104ff9:	55                   	push   %ebp
c0104ffa:	89 e5                	mov    %esp,%ebp
c0104ffc:	83 ec 28             	sub    $0x28,%esp
    assert(n > 0);
c0104fff:	83 7d 0c 00          	cmpl   $0x0,0xc(%ebp)
c0105003:	75 24                	jne    c0105029 <buddy_free_pages+0x30>
c0105005:	c7 44 24 0c f2 bd 10 	movl   $0xc010bdf2,0xc(%esp)
c010500c:	c0 
c010500d:	c7 44 24 08 91 bd 10 	movl   $0xc010bd91,0x8(%esp)
c0105014:	c0 
c0105015:	c7 44 24 04 bd 00 00 	movl   $0xbd,0x4(%esp)
c010501c:	00 
c010501d:	c7 04 24 a6 bd 10 c0 	movl   $0xc010bda6,(%esp)
c0105024:	e8 87 da ff ff       	call   c0102ab0 <__panic>
    if (n == 1) {
c0105029:	83 7d 0c 01          	cmpl   $0x1,0xc(%ebp)
c010502d:	75 18                	jne    c0105047 <buddy_free_pages+0x4e>
        buddy_free_pages_sub(base, 0);
c010502f:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
c0105036:	00 
c0105037:	8b 45 08             	mov    0x8(%ebp),%eax
c010503a:	89 04 24             	mov    %eax,(%esp)
c010503d:	e8 02 fd ff ff       	call   c0104d44 <buddy_free_pages_sub>
c0105042:	e9 c0 00 00 00       	jmp    c0105107 <buddy_free_pages+0x10e>
    }
    else {
        size_t order = 0, order_size = 1;
c0105047:	c7 45 f0 00 00 00 00 	movl   $0x0,-0x10(%ebp)
c010504e:	c7 45 f4 01 00 00 00 	movl   $0x1,-0xc(%ebp)
        while (n >= order_size) {
c0105055:	eb 6a                	jmp    c01050c1 <buddy_free_pages+0xc8>
            assert(order <= MAX_ORDER);
c0105057:	83 7d f0 0a          	cmpl   $0xa,-0x10(%ebp)
c010505b:	76 24                	jbe    c0105081 <buddy_free_pages+0x88>
c010505d:	c7 44 24 0c df bd 10 	movl   $0xc010bddf,0xc(%esp)
c0105064:	c0 
c0105065:	c7 44 24 08 91 bd 10 	movl   $0xc010bd91,0x8(%esp)
c010506c:	c0 
c010506d:	c7 44 24 04 c4 00 00 	movl   $0xc4,0x4(%esp)
c0105074:	00 
c0105075:	c7 04 24 a6 bd 10 c0 	movl   $0xc010bda6,(%esp)
c010507c:	e8 2f da ff ff       	call   c0102ab0 <__panic>
            if ((page2idx(base) & order_size) != 0) {
c0105081:	8b 45 08             	mov    0x8(%ebp),%eax
c0105084:	89 04 24             	mov    %eax,(%esp)
c0105087:	e8 76 fc ff ff       	call   c0104d02 <page2idx>
c010508c:	23 45 f4             	and    -0xc(%ebp),%eax
c010508f:	85 c0                	test   %eax,%eax
c0105091:	74 27                	je     c01050ba <buddy_free_pages+0xc1>
                buddy_free_pages_sub(base, order);
c0105093:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0105096:	89 44 24 04          	mov    %eax,0x4(%esp)
c010509a:	8b 45 08             	mov    0x8(%ebp),%eax
c010509d:	89 04 24             	mov    %eax,(%esp)
c01050a0:	e8 9f fc ff ff       	call   c0104d44 <buddy_free_pages_sub>
                base += order_size;
c01050a5:	8b 55 f4             	mov    -0xc(%ebp),%edx
c01050a8:	89 d0                	mov    %edx,%eax
c01050aa:	01 c0                	add    %eax,%eax
c01050ac:	01 d0                	add    %edx,%eax
c01050ae:	c1 e0 03             	shl    $0x3,%eax
c01050b1:	01 45 08             	add    %eax,0x8(%ebp)
                n -= order_size;
c01050b4:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01050b7:	29 45 0c             	sub    %eax,0xc(%ebp)
            }
            order ++;
c01050ba:	83 45 f0 01          	addl   $0x1,-0x10(%ebp)
            order_size <<= 1;
c01050be:	d1 65 f4             	shll   -0xc(%ebp)
    if (n == 1) {
        buddy_free_pages_sub(base, 0);
    }
    else {
        size_t order = 0, order_size = 1;
        while (n >= order_size) {
c01050c1:	8b 45 0c             	mov    0xc(%ebp),%eax
c01050c4:	3b 45 f4             	cmp    -0xc(%ebp),%eax
c01050c7:	73 8e                	jae    c0105057 <buddy_free_pages+0x5e>
                n -= order_size;
            }
            order ++;
            order_size <<= 1;
        }
        while (n != 0) {
c01050c9:	eb 36                	jmp    c0105101 <buddy_free_pages+0x108>
            while (n < order_size) {
                order --;
c01050cb:	83 6d f0 01          	subl   $0x1,-0x10(%ebp)
                order_size >>= 1;
c01050cf:	d1 6d f4             	shrl   -0xc(%ebp)
            }
            order ++;
            order_size <<= 1;
        }
        while (n != 0) {
            while (n < order_size) {
c01050d2:	8b 45 0c             	mov    0xc(%ebp),%eax
c01050d5:	3b 45 f4             	cmp    -0xc(%ebp),%eax
c01050d8:	72 f1                	jb     c01050cb <buddy_free_pages+0xd2>
                order --;
                order_size >>= 1;
            }
            buddy_free_pages_sub(base, order);
c01050da:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01050dd:	89 44 24 04          	mov    %eax,0x4(%esp)
c01050e1:	8b 45 08             	mov    0x8(%ebp),%eax
c01050e4:	89 04 24             	mov    %eax,(%esp)
c01050e7:	e8 58 fc ff ff       	call   c0104d44 <buddy_free_pages_sub>
            base += order_size;
c01050ec:	8b 55 f4             	mov    -0xc(%ebp),%edx
c01050ef:	89 d0                	mov    %edx,%eax
c01050f1:	01 c0                	add    %eax,%eax
c01050f3:	01 d0                	add    %edx,%eax
c01050f5:	c1 e0 03             	shl    $0x3,%eax
c01050f8:	01 45 08             	add    %eax,0x8(%ebp)
            n -= order_size;
c01050fb:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01050fe:	29 45 0c             	sub    %eax,0xc(%ebp)
                n -= order_size;
            }
            order ++;
            order_size <<= 1;
        }
        while (n != 0) {
c0105101:	83 7d 0c 00          	cmpl   $0x0,0xc(%ebp)
c0105105:	75 cb                	jne    c01050d2 <buddy_free_pages+0xd9>
            buddy_free_pages_sub(base, order);
            base += order_size;
            n -= order_size;
        }
    }
}
c0105107:	c9                   	leave  
c0105108:	c3                   	ret    

c0105109 <buddy_nr_free_pages>:

//buddy_nr_free_pages - get the nr: the number of free pages
static size_t
buddy_nr_free_pages(void) {
c0105109:	55                   	push   %ebp
c010510a:	89 e5                	mov    %esp,%ebp
c010510c:	53                   	push   %ebx
c010510d:	83 ec 10             	sub    $0x10,%esp
    size_t ret = 0, order = 0;
c0105110:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
c0105117:	c7 45 f8 00 00 00 00 	movl   $0x0,-0x8(%ebp)
    for (; order <= MAX_ORDER; order ++) {
c010511e:	eb 24                	jmp    c0105144 <buddy_nr_free_pages+0x3b>
        ret += nr_free(order) * (1 << order);
c0105120:	8b 55 f8             	mov    -0x8(%ebp),%edx
c0105123:	89 d0                	mov    %edx,%eax
c0105125:	01 c0                	add    %eax,%eax
c0105127:	01 d0                	add    %edx,%eax
c0105129:	c1 e0 02             	shl    $0x2,%eax
c010512c:	8b 90 68 89 12 c0    	mov    -0x3fed7698(%eax),%edx
c0105132:	8b 45 f8             	mov    -0x8(%ebp),%eax
c0105135:	89 d3                	mov    %edx,%ebx
c0105137:	89 c1                	mov    %eax,%ecx
c0105139:	d3 e3                	shl    %cl,%ebx
c010513b:	89 d8                	mov    %ebx,%eax
c010513d:	01 45 f4             	add    %eax,-0xc(%ebp)

//buddy_nr_free_pages - get the nr: the number of free pages
static size_t
buddy_nr_free_pages(void) {
    size_t ret = 0, order = 0;
    for (; order <= MAX_ORDER; order ++) {
c0105140:	83 45 f8 01          	addl   $0x1,-0x8(%ebp)
c0105144:	83 7d f8 0a          	cmpl   $0xa,-0x8(%ebp)
c0105148:	76 d6                	jbe    c0105120 <buddy_nr_free_pages+0x17>
        ret += nr_free(order) * (1 << order);
    }
    return ret;
c010514a:	8b 45 f4             	mov    -0xc(%ebp),%eax
}
c010514d:	83 c4 10             	add    $0x10,%esp
c0105150:	5b                   	pop    %ebx
c0105151:	5d                   	pop    %ebp
c0105152:	c3                   	ret    

c0105153 <buddy_check>:

//buddy_check - check the correctness of buddy system
static void
buddy_check(void) {
c0105153:	55                   	push   %ebp
c0105154:	89 e5                	mov    %esp,%ebp
c0105156:	53                   	push   %ebx
c0105157:	81 ec 54 01 00 00    	sub    $0x154,%esp
    int i;
    int count = 0, total = 0;
c010515d:	c7 85 44 ff ff ff 00 	movl   $0x0,-0xbc(%ebp)
c0105164:	00 00 00 
c0105167:	c7 85 48 ff ff ff 00 	movl   $0x0,-0xb8(%ebp)
c010516e:	00 00 00 
    for (i = 0; i <= MAX_ORDER; i ++) {
c0105171:	c7 85 40 ff ff ff 00 	movl   $0x0,-0xc0(%ebp)
c0105178:	00 00 00 
c010517b:	e9 06 01 00 00       	jmp    c0105286 <buddy_check+0x133>
        list_entry_t *list = &free_list(i), *le = list;
c0105180:	8b 95 40 ff ff ff    	mov    -0xc0(%ebp),%edx
c0105186:	89 d0                	mov    %edx,%eax
c0105188:	01 c0                	add    %eax,%eax
c010518a:	01 d0                	add    %edx,%eax
c010518c:	c1 e0 02             	shl    $0x2,%eax
c010518f:	05 60 89 12 c0       	add    $0xc0128960,%eax
c0105194:	89 85 58 ff ff ff    	mov    %eax,-0xa8(%ebp)
c010519a:	8b 85 58 ff ff ff    	mov    -0xa8(%ebp),%eax
c01051a0:	89 85 5c ff ff ff    	mov    %eax,-0xa4(%ebp)
        while ((le = list_next(le)) != list) {
c01051a6:	e9 a7 00 00 00       	jmp    c0105252 <buddy_check+0xff>
            struct Page *p = le2page(le, page_link);
c01051ab:	8b 85 5c ff ff ff    	mov    -0xa4(%ebp),%eax
c01051b1:	83 e8 10             	sub    $0x10,%eax
c01051b4:	89 85 60 ff ff ff    	mov    %eax,-0xa0(%ebp)
            assert(PageProperty(p) && p->property == i);
c01051ba:	8b 85 60 ff ff ff    	mov    -0xa0(%ebp),%eax
c01051c0:	83 c0 04             	add    $0x4,%eax
c01051c3:	c7 85 74 ff ff ff 01 	movl   $0x1,-0x8c(%ebp)
c01051ca:	00 00 00 
c01051cd:	89 85 70 ff ff ff    	mov    %eax,-0x90(%ebp)
 * @addr:   the address to count from
 * */
static inline bool
test_bit(int nr, volatile void *addr) {
    int oldbit;
    asm volatile ("btl %2, %1; sbbl %0,%0" : "=r" (oldbit) : "m" (*(volatile long *)addr), "Ir" (nr));
c01051d3:	8b 85 70 ff ff ff    	mov    -0x90(%ebp),%eax
c01051d9:	8b 95 74 ff ff ff    	mov    -0x8c(%ebp),%edx
c01051df:	0f a3 10             	bt     %edx,(%eax)
c01051e2:	19 c0                	sbb    %eax,%eax
c01051e4:	89 85 78 ff ff ff    	mov    %eax,-0x88(%ebp)
    return oldbit != 0;
c01051ea:	83 bd 78 ff ff ff 00 	cmpl   $0x0,-0x88(%ebp)
c01051f1:	0f 95 c0             	setne  %al
c01051f4:	0f b6 c0             	movzbl %al,%eax
c01051f7:	85 c0                	test   %eax,%eax
c01051f9:	74 13                	je     c010520e <buddy_check+0xbb>
c01051fb:	8b 85 60 ff ff ff    	mov    -0xa0(%ebp),%eax
c0105201:	8b 50 08             	mov    0x8(%eax),%edx
c0105204:	8b 85 40 ff ff ff    	mov    -0xc0(%ebp),%eax
c010520a:	39 c2                	cmp    %eax,%edx
c010520c:	74 24                	je     c0105232 <buddy_check+0xdf>
c010520e:	c7 44 24 0c 48 be 10 	movl   $0xc010be48,0xc(%esp)
c0105215:	c0 
c0105216:	c7 44 24 08 91 bd 10 	movl   $0xc010bd91,0x8(%esp)
c010521d:	c0 
c010521e:	c7 44 24 04 ec 00 00 	movl   $0xec,0x4(%esp)
c0105225:	00 
c0105226:	c7 04 24 a6 bd 10 c0 	movl   $0xc010bda6,(%esp)
c010522d:	e8 7e d8 ff ff       	call   c0102ab0 <__panic>
            count ++, total += (1 << i);
c0105232:	83 85 44 ff ff ff 01 	addl   $0x1,-0xbc(%ebp)
c0105239:	8b 85 40 ff ff ff    	mov    -0xc0(%ebp),%eax
c010523f:	ba 01 00 00 00       	mov    $0x1,%edx
c0105244:	89 d3                	mov    %edx,%ebx
c0105246:	89 c1                	mov    %eax,%ecx
c0105248:	d3 e3                	shl    %cl,%ebx
c010524a:	89 d8                	mov    %ebx,%eax
c010524c:	01 85 48 ff ff ff    	add    %eax,-0xb8(%ebp)
c0105252:	8b 85 5c ff ff ff    	mov    -0xa4(%ebp),%eax
c0105258:	89 85 7c ff ff ff    	mov    %eax,-0x84(%ebp)
 * list_next - get the next entry
 * @listelm:    the list head
 **/
static list_entry_t *
list_next(list_entry_t *listelm) {
    return listelm->next;
c010525e:	8b 85 7c ff ff ff    	mov    -0x84(%ebp),%eax
c0105264:	8b 40 04             	mov    0x4(%eax),%eax
buddy_check(void) {
    int i;
    int count = 0, total = 0;
    for (i = 0; i <= MAX_ORDER; i ++) {
        list_entry_t *list = &free_list(i), *le = list;
        while ((le = list_next(le)) != list) {
c0105267:	89 85 5c ff ff ff    	mov    %eax,-0xa4(%ebp)
c010526d:	8b 85 5c ff ff ff    	mov    -0xa4(%ebp),%eax
c0105273:	3b 85 58 ff ff ff    	cmp    -0xa8(%ebp),%eax
c0105279:	0f 85 2c ff ff ff    	jne    c01051ab <buddy_check+0x58>
//buddy_check - check the correctness of buddy system
static void
buddy_check(void) {
    int i;
    int count = 0, total = 0;
    for (i = 0; i <= MAX_ORDER; i ++) {
c010527f:	83 85 40 ff ff ff 01 	addl   $0x1,-0xc0(%ebp)
c0105286:	83 bd 40 ff ff ff 0a 	cmpl   $0xa,-0xc0(%ebp)
c010528d:	0f 8e ed fe ff ff    	jle    c0105180 <buddy_check+0x2d>
            struct Page *p = le2page(le, page_link);
            assert(PageProperty(p) && p->property == i);
            count ++, total += (1 << i);
        }
    }
    assert(total == nr_free_pages());
c0105293:	8b 9d 48 ff ff ff    	mov    -0xb8(%ebp),%ebx
c0105299:	e8 93 0d 00 00       	call   c0106031 <nr_free_pages>
c010529e:	39 c3                	cmp    %eax,%ebx
c01052a0:	74 24                	je     c01052c6 <buddy_check+0x173>
c01052a2:	c7 44 24 0c 6c be 10 	movl   $0xc010be6c,0xc(%esp)
c01052a9:	c0 
c01052aa:	c7 44 24 08 91 bd 10 	movl   $0xc010bd91,0x8(%esp)
c01052b1:	c0 
c01052b2:	c7 44 24 04 f0 00 00 	movl   $0xf0,0x4(%esp)
c01052b9:	00 
c01052ba:	c7 04 24 a6 bd 10 c0 	movl   $0xc010bda6,(%esp)
c01052c1:	e8 ea d7 ff ff       	call   c0102ab0 <__panic>

    struct Page *p0 = alloc_pages(8), *buddy = alloc_pages(8), *p1;
c01052c6:	c7 04 24 08 00 00 00 	movl   $0x8,(%esp)
c01052cd:	e8 fc 0c 00 00       	call   c0105fce <alloc_pages>
c01052d2:	89 85 4c ff ff ff    	mov    %eax,-0xb4(%ebp)
c01052d8:	c7 04 24 08 00 00 00 	movl   $0x8,(%esp)
c01052df:	e8 ea 0c 00 00       	call   c0105fce <alloc_pages>
c01052e4:	89 85 50 ff ff ff    	mov    %eax,-0xb0(%ebp)

    assert(p0 != NULL);
c01052ea:	83 bd 4c ff ff ff 00 	cmpl   $0x0,-0xb4(%ebp)
c01052f1:	75 24                	jne    c0105317 <buddy_check+0x1c4>
c01052f3:	c7 44 24 0c 85 be 10 	movl   $0xc010be85,0xc(%esp)
c01052fa:	c0 
c01052fb:	c7 44 24 08 91 bd 10 	movl   $0xc010bd91,0x8(%esp)
c0105302:	c0 
c0105303:	c7 44 24 04 f4 00 00 	movl   $0xf4,0x4(%esp)
c010530a:	00 
c010530b:	c7 04 24 a6 bd 10 c0 	movl   $0xc010bda6,(%esp)
c0105312:	e8 99 d7 ff ff       	call   c0102ab0 <__panic>
    assert((page2idx(p0) & 7) == 0);
c0105317:	8b 85 4c ff ff ff    	mov    -0xb4(%ebp),%eax
c010531d:	89 04 24             	mov    %eax,(%esp)
c0105320:	e8 dd f9 ff ff       	call   c0104d02 <page2idx>
c0105325:	83 e0 07             	and    $0x7,%eax
c0105328:	85 c0                	test   %eax,%eax
c010532a:	74 24                	je     c0105350 <buddy_check+0x1fd>
c010532c:	c7 44 24 0c 90 be 10 	movl   $0xc010be90,0xc(%esp)
c0105333:	c0 
c0105334:	c7 44 24 08 91 bd 10 	movl   $0xc010bd91,0x8(%esp)
c010533b:	c0 
c010533c:	c7 44 24 04 f5 00 00 	movl   $0xf5,0x4(%esp)
c0105343:	00 
c0105344:	c7 04 24 a6 bd 10 c0 	movl   $0xc010bda6,(%esp)
c010534b:	e8 60 d7 ff ff       	call   c0102ab0 <__panic>
    assert(!PageProperty(p0));
c0105350:	8b 85 4c ff ff ff    	mov    -0xb4(%ebp),%eax
c0105356:	83 c0 04             	add    $0x4,%eax
c0105359:	c7 45 84 01 00 00 00 	movl   $0x1,-0x7c(%ebp)
c0105360:	89 45 80             	mov    %eax,-0x80(%ebp)
 * @addr:   the address to count from
 * */
static inline bool
test_bit(int nr, volatile void *addr) {
    int oldbit;
    asm volatile ("btl %2, %1; sbbl %0,%0" : "=r" (oldbit) : "m" (*(volatile long *)addr), "Ir" (nr));
c0105363:	8b 45 80             	mov    -0x80(%ebp),%eax
c0105366:	8b 55 84             	mov    -0x7c(%ebp),%edx
c0105369:	0f a3 10             	bt     %edx,(%eax)
c010536c:	19 c0                	sbb    %eax,%eax
c010536e:	89 45 88             	mov    %eax,-0x78(%ebp)
    return oldbit != 0;
c0105371:	83 7d 88 00          	cmpl   $0x0,-0x78(%ebp)
c0105375:	0f 95 c0             	setne  %al
c0105378:	0f b6 c0             	movzbl %al,%eax
c010537b:	85 c0                	test   %eax,%eax
c010537d:	74 24                	je     c01053a3 <buddy_check+0x250>
c010537f:	c7 44 24 0c a8 be 10 	movl   $0xc010bea8,0xc(%esp)
c0105386:	c0 
c0105387:	c7 44 24 08 91 bd 10 	movl   $0xc010bd91,0x8(%esp)
c010538e:	c0 
c010538f:	c7 44 24 04 f6 00 00 	movl   $0xf6,0x4(%esp)
c0105396:	00 
c0105397:	c7 04 24 a6 bd 10 c0 	movl   $0xc010bda6,(%esp)
c010539e:	e8 0d d7 ff ff       	call   c0102ab0 <__panic>

    list_entry_t free_lists_store[MAX_ORDER + 1];
    unsigned int nr_free_store[MAX_ORDER + 1];

    for (i = 0; i <= MAX_ORDER; i ++) {
c01053a3:	c7 85 40 ff ff ff 00 	movl   $0x0,-0xc0(%ebp)
c01053aa:	00 00 00 
c01053ad:	e9 ea 00 00 00       	jmp    c010549c <buddy_check+0x349>
        free_lists_store[i] = free_list(i);
c01053b2:	8b 8d 40 ff ff ff    	mov    -0xc0(%ebp),%ecx
c01053b8:	8b 95 40 ff ff ff    	mov    -0xc0(%ebp),%edx
c01053be:	89 d0                	mov    %edx,%eax
c01053c0:	01 c0                	add    %eax,%eax
c01053c2:	01 d0                	add    %edx,%eax
c01053c4:	c1 e0 02             	shl    $0x2,%eax
c01053c7:	8b 90 64 89 12 c0    	mov    -0x3fed769c(%eax),%edx
c01053cd:	8b 80 60 89 12 c0    	mov    -0x3fed76a0(%eax),%eax
c01053d3:	89 84 cd e8 fe ff ff 	mov    %eax,-0x118(%ebp,%ecx,8)
c01053da:	89 94 cd ec fe ff ff 	mov    %edx,-0x114(%ebp,%ecx,8)
        list_init(&free_list(i));
c01053e1:	8b 95 40 ff ff ff    	mov    -0xc0(%ebp),%edx
c01053e7:	89 d0                	mov    %edx,%eax
c01053e9:	01 c0                	add    %eax,%eax
c01053eb:	01 d0                	add    %edx,%eax
c01053ed:	c1 e0 02             	shl    $0x2,%eax
c01053f0:	05 60 89 12 c0       	add    $0xc0128960,%eax
c01053f5:	89 45 8c             	mov    %eax,-0x74(%ebp)
 * list_init - initialize a new entry
 * @elm:        new entry to be initialized
 * */
static inline void
list_init(list_entry_t *elm) {
    elm->prev = elm->next = elm;
c01053f8:	8b 45 8c             	mov    -0x74(%ebp),%eax
c01053fb:	8b 55 8c             	mov    -0x74(%ebp),%edx
c01053fe:	89 50 04             	mov    %edx,0x4(%eax)
c0105401:	8b 45 8c             	mov    -0x74(%ebp),%eax
c0105404:	8b 50 04             	mov    0x4(%eax),%edx
c0105407:	8b 45 8c             	mov    -0x74(%ebp),%eax
c010540a:	89 10                	mov    %edx,(%eax)
        assert(list_empty(&free_list(i)));
c010540c:	8b 95 40 ff ff ff    	mov    -0xc0(%ebp),%edx
c0105412:	89 d0                	mov    %edx,%eax
c0105414:	01 c0                	add    %eax,%eax
c0105416:	01 d0                	add    %edx,%eax
c0105418:	c1 e0 02             	shl    $0x2,%eax
c010541b:	05 60 89 12 c0       	add    $0xc0128960,%eax
c0105420:	89 45 90             	mov    %eax,-0x70(%ebp)
 * list_empty - tests whether a list is empty
 * @list:       the list to test.
 * */
static inline bool
list_empty(list_entry_t *list) {
    return list->next == list;
c0105423:	8b 45 90             	mov    -0x70(%ebp),%eax
c0105426:	8b 40 04             	mov    0x4(%eax),%eax
c0105429:	39 45 90             	cmp    %eax,-0x70(%ebp)
c010542c:	0f 94 c0             	sete   %al
c010542f:	0f b6 c0             	movzbl %al,%eax
c0105432:	85 c0                	test   %eax,%eax
c0105434:	75 24                	jne    c010545a <buddy_check+0x307>
c0105436:	c7 44 24 0c ba be 10 	movl   $0xc010beba,0xc(%esp)
c010543d:	c0 
c010543e:	c7 44 24 08 91 bd 10 	movl   $0xc010bd91,0x8(%esp)
c0105445:	c0 
c0105446:	c7 44 24 04 fe 00 00 	movl   $0xfe,0x4(%esp)
c010544d:	00 
c010544e:	c7 04 24 a6 bd 10 c0 	movl   $0xc010bda6,(%esp)
c0105455:	e8 56 d6 ff ff       	call   c0102ab0 <__panic>
        nr_free_store[i] = nr_free(i);
c010545a:	8b 8d 40 ff ff ff    	mov    -0xc0(%ebp),%ecx
c0105460:	8b 95 40 ff ff ff    	mov    -0xc0(%ebp),%edx
c0105466:	89 d0                	mov    %edx,%eax
c0105468:	01 c0                	add    %eax,%eax
c010546a:	01 d0                	add    %edx,%eax
c010546c:	c1 e0 02             	shl    $0x2,%eax
c010546f:	8b 80 68 89 12 c0    	mov    -0x3fed7698(%eax),%eax
c0105475:	89 84 8d bc fe ff ff 	mov    %eax,-0x144(%ebp,%ecx,4)
        nr_free(i) = 0;
c010547c:	8b 95 40 ff ff ff    	mov    -0xc0(%ebp),%edx
c0105482:	89 d0                	mov    %edx,%eax
c0105484:	01 c0                	add    %eax,%eax
c0105486:	01 d0                	add    %edx,%eax
c0105488:	c1 e0 02             	shl    $0x2,%eax
c010548b:	c7 80 68 89 12 c0 00 	movl   $0x0,-0x3fed7698(%eax)
c0105492:	00 00 00 
    assert(!PageProperty(p0));

    list_entry_t free_lists_store[MAX_ORDER + 1];
    unsigned int nr_free_store[MAX_ORDER + 1];

    for (i = 0; i <= MAX_ORDER; i ++) {
c0105495:	83 85 40 ff ff ff 01 	addl   $0x1,-0xc0(%ebp)
c010549c:	83 bd 40 ff ff ff 0a 	cmpl   $0xa,-0xc0(%ebp)
c01054a3:	0f 8e 09 ff ff ff    	jle    c01053b2 <buddy_check+0x25f>
        assert(list_empty(&free_list(i)));
        nr_free_store[i] = nr_free(i);
        nr_free(i) = 0;
    }

    assert(nr_free_pages() == 0);
c01054a9:	e8 83 0b 00 00       	call   c0106031 <nr_free_pages>
c01054ae:	85 c0                	test   %eax,%eax
c01054b0:	74 24                	je     c01054d6 <buddy_check+0x383>
c01054b2:	c7 44 24 0c d4 be 10 	movl   $0xc010bed4,0xc(%esp)
c01054b9:	c0 
c01054ba:	c7 44 24 08 91 bd 10 	movl   $0xc010bd91,0x8(%esp)
c01054c1:	c0 
c01054c2:	c7 44 24 04 03 01 00 	movl   $0x103,0x4(%esp)
c01054c9:	00 
c01054ca:	c7 04 24 a6 bd 10 c0 	movl   $0xc010bda6,(%esp)
c01054d1:	e8 da d5 ff ff       	call   c0102ab0 <__panic>
    assert(alloc_page() == NULL);
c01054d6:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
c01054dd:	e8 ec 0a 00 00       	call   c0105fce <alloc_pages>
c01054e2:	85 c0                	test   %eax,%eax
c01054e4:	74 24                	je     c010550a <buddy_check+0x3b7>
c01054e6:	c7 44 24 0c e9 be 10 	movl   $0xc010bee9,0xc(%esp)
c01054ed:	c0 
c01054ee:	c7 44 24 08 91 bd 10 	movl   $0xc010bd91,0x8(%esp)
c01054f5:	c0 
c01054f6:	c7 44 24 04 04 01 00 	movl   $0x104,0x4(%esp)
c01054fd:	00 
c01054fe:	c7 04 24 a6 bd 10 c0 	movl   $0xc010bda6,(%esp)
c0105505:	e8 a6 d5 ff ff       	call   c0102ab0 <__panic>
    free_pages(p0, 8);
c010550a:	c7 44 24 04 08 00 00 	movl   $0x8,0x4(%esp)
c0105511:	00 
c0105512:	8b 85 4c ff ff ff    	mov    -0xb4(%ebp),%eax
c0105518:	89 04 24             	mov    %eax,(%esp)
c010551b:	e8 df 0a 00 00       	call   c0105fff <free_pages>
    assert(nr_free_pages() == 8);
c0105520:	e8 0c 0b 00 00       	call   c0106031 <nr_free_pages>
c0105525:	83 f8 08             	cmp    $0x8,%eax
c0105528:	74 24                	je     c010554e <buddy_check+0x3fb>
c010552a:	c7 44 24 0c fe be 10 	movl   $0xc010befe,0xc(%esp)
c0105531:	c0 
c0105532:	c7 44 24 08 91 bd 10 	movl   $0xc010bd91,0x8(%esp)
c0105539:	c0 
c010553a:	c7 44 24 04 06 01 00 	movl   $0x106,0x4(%esp)
c0105541:	00 
c0105542:	c7 04 24 a6 bd 10 c0 	movl   $0xc010bda6,(%esp)
c0105549:	e8 62 d5 ff ff       	call   c0102ab0 <__panic>
    assert(PageProperty(p0) && p0->property == 3);
c010554e:	8b 85 4c ff ff ff    	mov    -0xb4(%ebp),%eax
c0105554:	83 c0 04             	add    $0x4,%eax
c0105557:	c7 45 98 01 00 00 00 	movl   $0x1,-0x68(%ebp)
c010555e:	89 45 94             	mov    %eax,-0x6c(%ebp)
 * @addr:   the address to count from
 * */
static inline bool
test_bit(int nr, volatile void *addr) {
    int oldbit;
    asm volatile ("btl %2, %1; sbbl %0,%0" : "=r" (oldbit) : "m" (*(volatile long *)addr), "Ir" (nr));
c0105561:	8b 45 94             	mov    -0x6c(%ebp),%eax
c0105564:	8b 55 98             	mov    -0x68(%ebp),%edx
c0105567:	0f a3 10             	bt     %edx,(%eax)
c010556a:	19 c0                	sbb    %eax,%eax
c010556c:	89 45 9c             	mov    %eax,-0x64(%ebp)
    return oldbit != 0;
c010556f:	83 7d 9c 00          	cmpl   $0x0,-0x64(%ebp)
c0105573:	0f 95 c0             	setne  %al
c0105576:	0f b6 c0             	movzbl %al,%eax
c0105579:	85 c0                	test   %eax,%eax
c010557b:	74 0e                	je     c010558b <buddy_check+0x438>
c010557d:	8b 85 4c ff ff ff    	mov    -0xb4(%ebp),%eax
c0105583:	8b 40 08             	mov    0x8(%eax),%eax
c0105586:	83 f8 03             	cmp    $0x3,%eax
c0105589:	74 24                	je     c01055af <buddy_check+0x45c>
c010558b:	c7 44 24 0c 14 bf 10 	movl   $0xc010bf14,0xc(%esp)
c0105592:	c0 
c0105593:	c7 44 24 08 91 bd 10 	movl   $0xc010bd91,0x8(%esp)
c010559a:	c0 
c010559b:	c7 44 24 04 07 01 00 	movl   $0x107,0x4(%esp)
c01055a2:	00 
c01055a3:	c7 04 24 a6 bd 10 c0 	movl   $0xc010bda6,(%esp)
c01055aa:	e8 01 d5 ff ff       	call   c0102ab0 <__panic>
    assert((p0 = alloc_pages(6)) != NULL && !PageProperty(p0) && nr_free_pages() == 2);
c01055af:	c7 04 24 06 00 00 00 	movl   $0x6,(%esp)
c01055b6:	e8 13 0a 00 00       	call   c0105fce <alloc_pages>
c01055bb:	89 85 4c ff ff ff    	mov    %eax,-0xb4(%ebp)
c01055c1:	83 bd 4c ff ff ff 00 	cmpl   $0x0,-0xb4(%ebp)
c01055c8:	74 39                	je     c0105603 <buddy_check+0x4b0>
c01055ca:	8b 85 4c ff ff ff    	mov    -0xb4(%ebp),%eax
c01055d0:	83 c0 04             	add    $0x4,%eax
c01055d3:	c7 45 a4 01 00 00 00 	movl   $0x1,-0x5c(%ebp)
c01055da:	89 45 a0             	mov    %eax,-0x60(%ebp)
 * @addr:   the address to count from
 * */
static inline bool
test_bit(int nr, volatile void *addr) {
    int oldbit;
    asm volatile ("btl %2, %1; sbbl %0,%0" : "=r" (oldbit) : "m" (*(volatile long *)addr), "Ir" (nr));
c01055dd:	8b 45 a0             	mov    -0x60(%ebp),%eax
c01055e0:	8b 55 a4             	mov    -0x5c(%ebp),%edx
c01055e3:	0f a3 10             	bt     %edx,(%eax)
c01055e6:	19 c0                	sbb    %eax,%eax
c01055e8:	89 45 a8             	mov    %eax,-0x58(%ebp)
    return oldbit != 0;
c01055eb:	83 7d a8 00          	cmpl   $0x0,-0x58(%ebp)
c01055ef:	0f 95 c0             	setne  %al
c01055f2:	0f b6 c0             	movzbl %al,%eax
c01055f5:	85 c0                	test   %eax,%eax
c01055f7:	75 0a                	jne    c0105603 <buddy_check+0x4b0>
c01055f9:	e8 33 0a 00 00       	call   c0106031 <nr_free_pages>
c01055fe:	83 f8 02             	cmp    $0x2,%eax
c0105601:	74 24                	je     c0105627 <buddy_check+0x4d4>
c0105603:	c7 44 24 0c 3c bf 10 	movl   $0xc010bf3c,0xc(%esp)
c010560a:	c0 
c010560b:	c7 44 24 08 91 bd 10 	movl   $0xc010bd91,0x8(%esp)
c0105612:	c0 
c0105613:	c7 44 24 04 08 01 00 	movl   $0x108,0x4(%esp)
c010561a:	00 
c010561b:	c7 04 24 a6 bd 10 c0 	movl   $0xc010bda6,(%esp)
c0105622:	e8 89 d4 ff ff       	call   c0102ab0 <__panic>

    assert((p1 = alloc_pages(2)) != NULL && p1 == p0 + 6);
c0105627:	c7 04 24 02 00 00 00 	movl   $0x2,(%esp)
c010562e:	e8 9b 09 00 00       	call   c0105fce <alloc_pages>
c0105633:	89 85 54 ff ff ff    	mov    %eax,-0xac(%ebp)
c0105639:	83 bd 54 ff ff ff 00 	cmpl   $0x0,-0xac(%ebp)
c0105640:	74 13                	je     c0105655 <buddy_check+0x502>
c0105642:	8b 85 4c ff ff ff    	mov    -0xb4(%ebp),%eax
c0105648:	05 90 00 00 00       	add    $0x90,%eax
c010564d:	3b 85 54 ff ff ff    	cmp    -0xac(%ebp),%eax
c0105653:	74 24                	je     c0105679 <buddy_check+0x526>
c0105655:	c7 44 24 0c 88 bf 10 	movl   $0xc010bf88,0xc(%esp)
c010565c:	c0 
c010565d:	c7 44 24 08 91 bd 10 	movl   $0xc010bd91,0x8(%esp)
c0105664:	c0 
c0105665:	c7 44 24 04 0a 01 00 	movl   $0x10a,0x4(%esp)
c010566c:	00 
c010566d:	c7 04 24 a6 bd 10 c0 	movl   $0xc010bda6,(%esp)
c0105674:	e8 37 d4 ff ff       	call   c0102ab0 <__panic>
    assert(nr_free_pages() == 0);
c0105679:	e8 b3 09 00 00       	call   c0106031 <nr_free_pages>
c010567e:	85 c0                	test   %eax,%eax
c0105680:	74 24                	je     c01056a6 <buddy_check+0x553>
c0105682:	c7 44 24 0c d4 be 10 	movl   $0xc010bed4,0xc(%esp)
c0105689:	c0 
c010568a:	c7 44 24 08 91 bd 10 	movl   $0xc010bd91,0x8(%esp)
c0105691:	c0 
c0105692:	c7 44 24 04 0b 01 00 	movl   $0x10b,0x4(%esp)
c0105699:	00 
c010569a:	c7 04 24 a6 bd 10 c0 	movl   $0xc010bda6,(%esp)
c01056a1:	e8 0a d4 ff ff       	call   c0102ab0 <__panic>

    free_pages(p0, 3);
c01056a6:	c7 44 24 04 03 00 00 	movl   $0x3,0x4(%esp)
c01056ad:	00 
c01056ae:	8b 85 4c ff ff ff    	mov    -0xb4(%ebp),%eax
c01056b4:	89 04 24             	mov    %eax,(%esp)
c01056b7:	e8 43 09 00 00       	call   c0105fff <free_pages>
    assert(PageProperty(p0) && p0->property == 1);
c01056bc:	8b 85 4c ff ff ff    	mov    -0xb4(%ebp),%eax
c01056c2:	83 c0 04             	add    $0x4,%eax
c01056c5:	c7 45 b0 01 00 00 00 	movl   $0x1,-0x50(%ebp)
c01056cc:	89 45 ac             	mov    %eax,-0x54(%ebp)
 * @addr:   the address to count from
 * */
static inline bool
test_bit(int nr, volatile void *addr) {
    int oldbit;
    asm volatile ("btl %2, %1; sbbl %0,%0" : "=r" (oldbit) : "m" (*(volatile long *)addr), "Ir" (nr));
c01056cf:	8b 45 ac             	mov    -0x54(%ebp),%eax
c01056d2:	8b 55 b0             	mov    -0x50(%ebp),%edx
c01056d5:	0f a3 10             	bt     %edx,(%eax)
c01056d8:	19 c0                	sbb    %eax,%eax
c01056da:	89 45 b4             	mov    %eax,-0x4c(%ebp)
    return oldbit != 0;
c01056dd:	83 7d b4 00          	cmpl   $0x0,-0x4c(%ebp)
c01056e1:	0f 95 c0             	setne  %al
c01056e4:	0f b6 c0             	movzbl %al,%eax
c01056e7:	85 c0                	test   %eax,%eax
c01056e9:	74 0e                	je     c01056f9 <buddy_check+0x5a6>
c01056eb:	8b 85 4c ff ff ff    	mov    -0xb4(%ebp),%eax
c01056f1:	8b 40 08             	mov    0x8(%eax),%eax
c01056f4:	83 f8 01             	cmp    $0x1,%eax
c01056f7:	74 24                	je     c010571d <buddy_check+0x5ca>
c01056f9:	c7 44 24 0c b8 bf 10 	movl   $0xc010bfb8,0xc(%esp)
c0105700:	c0 
c0105701:	c7 44 24 08 91 bd 10 	movl   $0xc010bd91,0x8(%esp)
c0105708:	c0 
c0105709:	c7 44 24 04 0e 01 00 	movl   $0x10e,0x4(%esp)
c0105710:	00 
c0105711:	c7 04 24 a6 bd 10 c0 	movl   $0xc010bda6,(%esp)
c0105718:	e8 93 d3 ff ff       	call   c0102ab0 <__panic>
    assert(PageProperty(p0 + 2) && p0[2].property == 0);
c010571d:	8b 85 4c ff ff ff    	mov    -0xb4(%ebp),%eax
c0105723:	83 c0 30             	add    $0x30,%eax
c0105726:	83 c0 04             	add    $0x4,%eax
c0105729:	c7 45 bc 01 00 00 00 	movl   $0x1,-0x44(%ebp)
c0105730:	89 45 b8             	mov    %eax,-0x48(%ebp)
 * @addr:   the address to count from
 * */
static inline bool
test_bit(int nr, volatile void *addr) {
    int oldbit;
    asm volatile ("btl %2, %1; sbbl %0,%0" : "=r" (oldbit) : "m" (*(volatile long *)addr), "Ir" (nr));
c0105733:	8b 45 b8             	mov    -0x48(%ebp),%eax
c0105736:	8b 55 bc             	mov    -0x44(%ebp),%edx
c0105739:	0f a3 10             	bt     %edx,(%eax)
c010573c:	19 c0                	sbb    %eax,%eax
c010573e:	89 45 c0             	mov    %eax,-0x40(%ebp)
    return oldbit != 0;
c0105741:	83 7d c0 00          	cmpl   $0x0,-0x40(%ebp)
c0105745:	0f 95 c0             	setne  %al
c0105748:	0f b6 c0             	movzbl %al,%eax
c010574b:	85 c0                	test   %eax,%eax
c010574d:	74 10                	je     c010575f <buddy_check+0x60c>
c010574f:	8b 85 4c ff ff ff    	mov    -0xb4(%ebp),%eax
c0105755:	83 c0 30             	add    $0x30,%eax
c0105758:	8b 40 08             	mov    0x8(%eax),%eax
c010575b:	85 c0                	test   %eax,%eax
c010575d:	74 24                	je     c0105783 <buddy_check+0x630>
c010575f:	c7 44 24 0c e0 bf 10 	movl   $0xc010bfe0,0xc(%esp)
c0105766:	c0 
c0105767:	c7 44 24 08 91 bd 10 	movl   $0xc010bd91,0x8(%esp)
c010576e:	c0 
c010576f:	c7 44 24 04 0f 01 00 	movl   $0x10f,0x4(%esp)
c0105776:	00 
c0105777:	c7 04 24 a6 bd 10 c0 	movl   $0xc010bda6,(%esp)
c010577e:	e8 2d d3 ff ff       	call   c0102ab0 <__panic>

    free_pages(p0 + 3, 3);
c0105783:	8b 85 4c ff ff ff    	mov    -0xb4(%ebp),%eax
c0105789:	83 c0 48             	add    $0x48,%eax
c010578c:	c7 44 24 04 03 00 00 	movl   $0x3,0x4(%esp)
c0105793:	00 
c0105794:	89 04 24             	mov    %eax,(%esp)
c0105797:	e8 63 08 00 00       	call   c0105fff <free_pages>
    free_pages(p1, 2);
c010579c:	c7 44 24 04 02 00 00 	movl   $0x2,0x4(%esp)
c01057a3:	00 
c01057a4:	8b 85 54 ff ff ff    	mov    -0xac(%ebp),%eax
c01057aa:	89 04 24             	mov    %eax,(%esp)
c01057ad:	e8 4d 08 00 00       	call   c0105fff <free_pages>

    assert(PageProperty(p0) && p0->property == 3);
c01057b2:	8b 85 4c ff ff ff    	mov    -0xb4(%ebp),%eax
c01057b8:	83 c0 04             	add    $0x4,%eax
c01057bb:	c7 45 c8 01 00 00 00 	movl   $0x1,-0x38(%ebp)
c01057c2:	89 45 c4             	mov    %eax,-0x3c(%ebp)
 * @addr:   the address to count from
 * */
static inline bool
test_bit(int nr, volatile void *addr) {
    int oldbit;
    asm volatile ("btl %2, %1; sbbl %0,%0" : "=r" (oldbit) : "m" (*(volatile long *)addr), "Ir" (nr));
c01057c5:	8b 45 c4             	mov    -0x3c(%ebp),%eax
c01057c8:	8b 55 c8             	mov    -0x38(%ebp),%edx
c01057cb:	0f a3 10             	bt     %edx,(%eax)
c01057ce:	19 c0                	sbb    %eax,%eax
c01057d0:	89 45 cc             	mov    %eax,-0x34(%ebp)
    return oldbit != 0;
c01057d3:	83 7d cc 00          	cmpl   $0x0,-0x34(%ebp)
c01057d7:	0f 95 c0             	setne  %al
c01057da:	0f b6 c0             	movzbl %al,%eax
c01057dd:	85 c0                	test   %eax,%eax
c01057df:	74 0e                	je     c01057ef <buddy_check+0x69c>
c01057e1:	8b 85 4c ff ff ff    	mov    -0xb4(%ebp),%eax
c01057e7:	8b 40 08             	mov    0x8(%eax),%eax
c01057ea:	83 f8 03             	cmp    $0x3,%eax
c01057ed:	74 24                	je     c0105813 <buddy_check+0x6c0>
c01057ef:	c7 44 24 0c 14 bf 10 	movl   $0xc010bf14,0xc(%esp)
c01057f6:	c0 
c01057f7:	c7 44 24 08 91 bd 10 	movl   $0xc010bd91,0x8(%esp)
c01057fe:	c0 
c01057ff:	c7 44 24 04 14 01 00 	movl   $0x114,0x4(%esp)
c0105806:	00 
c0105807:	c7 04 24 a6 bd 10 c0 	movl   $0xc010bda6,(%esp)
c010580e:	e8 9d d2 ff ff       	call   c0102ab0 <__panic>

    assert((p0 = alloc_pages(6)) != NULL);
c0105813:	c7 04 24 06 00 00 00 	movl   $0x6,(%esp)
c010581a:	e8 af 07 00 00       	call   c0105fce <alloc_pages>
c010581f:	89 85 4c ff ff ff    	mov    %eax,-0xb4(%ebp)
c0105825:	83 bd 4c ff ff ff 00 	cmpl   $0x0,-0xb4(%ebp)
c010582c:	75 24                	jne    c0105852 <buddy_check+0x6ff>
c010582e:	c7 44 24 0c 0c c0 10 	movl   $0xc010c00c,0xc(%esp)
c0105835:	c0 
c0105836:	c7 44 24 08 91 bd 10 	movl   $0xc010bd91,0x8(%esp)
c010583d:	c0 
c010583e:	c7 44 24 04 16 01 00 	movl   $0x116,0x4(%esp)
c0105845:	00 
c0105846:	c7 04 24 a6 bd 10 c0 	movl   $0xc010bda6,(%esp)
c010584d:	e8 5e d2 ff ff       	call   c0102ab0 <__panic>
    assert((p1 = alloc_pages(2)) != NULL);
c0105852:	c7 04 24 02 00 00 00 	movl   $0x2,(%esp)
c0105859:	e8 70 07 00 00       	call   c0105fce <alloc_pages>
c010585e:	89 85 54 ff ff ff    	mov    %eax,-0xac(%ebp)
c0105864:	83 bd 54 ff ff ff 00 	cmpl   $0x0,-0xac(%ebp)
c010586b:	75 24                	jne    c0105891 <buddy_check+0x73e>
c010586d:	c7 44 24 0c 2a c0 10 	movl   $0xc010c02a,0xc(%esp)
c0105874:	c0 
c0105875:	c7 44 24 08 91 bd 10 	movl   $0xc010bd91,0x8(%esp)
c010587c:	c0 
c010587d:	c7 44 24 04 17 01 00 	movl   $0x117,0x4(%esp)
c0105884:	00 
c0105885:	c7 04 24 a6 bd 10 c0 	movl   $0xc010bda6,(%esp)
c010588c:	e8 1f d2 ff ff       	call   c0102ab0 <__panic>
    free_pages(p0 + 4, 2);
c0105891:	8b 85 4c ff ff ff    	mov    -0xb4(%ebp),%eax
c0105897:	83 c0 60             	add    $0x60,%eax
c010589a:	c7 44 24 04 02 00 00 	movl   $0x2,0x4(%esp)
c01058a1:	00 
c01058a2:	89 04 24             	mov    %eax,(%esp)
c01058a5:	e8 55 07 00 00       	call   c0105fff <free_pages>
    free_pages(p1, 2);
c01058aa:	c7 44 24 04 02 00 00 	movl   $0x2,0x4(%esp)
c01058b1:	00 
c01058b2:	8b 85 54 ff ff ff    	mov    -0xac(%ebp),%eax
c01058b8:	89 04 24             	mov    %eax,(%esp)
c01058bb:	e8 3f 07 00 00       	call   c0105fff <free_pages>

    p1 = p0 + 4;
c01058c0:	8b 85 4c ff ff ff    	mov    -0xb4(%ebp),%eax
c01058c6:	83 c0 60             	add    $0x60,%eax
c01058c9:	89 85 54 ff ff ff    	mov    %eax,-0xac(%ebp)
    assert(PageProperty(p1) && p1->property == 2);
c01058cf:	8b 85 54 ff ff ff    	mov    -0xac(%ebp),%eax
c01058d5:	83 c0 04             	add    $0x4,%eax
c01058d8:	c7 45 d4 01 00 00 00 	movl   $0x1,-0x2c(%ebp)
c01058df:	89 45 d0             	mov    %eax,-0x30(%ebp)
 * @addr:   the address to count from
 * */
static inline bool
test_bit(int nr, volatile void *addr) {
    int oldbit;
    asm volatile ("btl %2, %1; sbbl %0,%0" : "=r" (oldbit) : "m" (*(volatile long *)addr), "Ir" (nr));
c01058e2:	8b 45 d0             	mov    -0x30(%ebp),%eax
c01058e5:	8b 55 d4             	mov    -0x2c(%ebp),%edx
c01058e8:	0f a3 10             	bt     %edx,(%eax)
c01058eb:	19 c0                	sbb    %eax,%eax
c01058ed:	89 45 d8             	mov    %eax,-0x28(%ebp)
    return oldbit != 0;
c01058f0:	83 7d d8 00          	cmpl   $0x0,-0x28(%ebp)
c01058f4:	0f 95 c0             	setne  %al
c01058f7:	0f b6 c0             	movzbl %al,%eax
c01058fa:	85 c0                	test   %eax,%eax
c01058fc:	74 0e                	je     c010590c <buddy_check+0x7b9>
c01058fe:	8b 85 54 ff ff ff    	mov    -0xac(%ebp),%eax
c0105904:	8b 40 08             	mov    0x8(%eax),%eax
c0105907:	83 f8 02             	cmp    $0x2,%eax
c010590a:	74 24                	je     c0105930 <buddy_check+0x7dd>
c010590c:	c7 44 24 0c 48 c0 10 	movl   $0xc010c048,0xc(%esp)
c0105913:	c0 
c0105914:	c7 44 24 08 91 bd 10 	movl   $0xc010bd91,0x8(%esp)
c010591b:	c0 
c010591c:	c7 44 24 04 1c 01 00 	movl   $0x11c,0x4(%esp)
c0105923:	00 
c0105924:	c7 04 24 a6 bd 10 c0 	movl   $0xc010bda6,(%esp)
c010592b:	e8 80 d1 ff ff       	call   c0102ab0 <__panic>
    free_pages(p0, 4);
c0105930:	c7 44 24 04 04 00 00 	movl   $0x4,0x4(%esp)
c0105937:	00 
c0105938:	8b 85 4c ff ff ff    	mov    -0xb4(%ebp),%eax
c010593e:	89 04 24             	mov    %eax,(%esp)
c0105941:	e8 b9 06 00 00       	call   c0105fff <free_pages>
    assert(PageProperty(p0) && p0->property == 3);
c0105946:	8b 85 4c ff ff ff    	mov    -0xb4(%ebp),%eax
c010594c:	83 c0 04             	add    $0x4,%eax
c010594f:	c7 45 e0 01 00 00 00 	movl   $0x1,-0x20(%ebp)
c0105956:	89 45 dc             	mov    %eax,-0x24(%ebp)
 * @addr:   the address to count from
 * */
static inline bool
test_bit(int nr, volatile void *addr) {
    int oldbit;
    asm volatile ("btl %2, %1; sbbl %0,%0" : "=r" (oldbit) : "m" (*(volatile long *)addr), "Ir" (nr));
c0105959:	8b 45 dc             	mov    -0x24(%ebp),%eax
c010595c:	8b 55 e0             	mov    -0x20(%ebp),%edx
c010595f:	0f a3 10             	bt     %edx,(%eax)
c0105962:	19 c0                	sbb    %eax,%eax
c0105964:	89 45 e4             	mov    %eax,-0x1c(%ebp)
    return oldbit != 0;
c0105967:	83 7d e4 00          	cmpl   $0x0,-0x1c(%ebp)
c010596b:	0f 95 c0             	setne  %al
c010596e:	0f b6 c0             	movzbl %al,%eax
c0105971:	85 c0                	test   %eax,%eax
c0105973:	74 0e                	je     c0105983 <buddy_check+0x830>
c0105975:	8b 85 4c ff ff ff    	mov    -0xb4(%ebp),%eax
c010597b:	8b 40 08             	mov    0x8(%eax),%eax
c010597e:	83 f8 03             	cmp    $0x3,%eax
c0105981:	74 24                	je     c01059a7 <buddy_check+0x854>
c0105983:	c7 44 24 0c 14 bf 10 	movl   $0xc010bf14,0xc(%esp)
c010598a:	c0 
c010598b:	c7 44 24 08 91 bd 10 	movl   $0xc010bd91,0x8(%esp)
c0105992:	c0 
c0105993:	c7 44 24 04 1e 01 00 	movl   $0x11e,0x4(%esp)
c010599a:	00 
c010599b:	c7 04 24 a6 bd 10 c0 	movl   $0xc010bda6,(%esp)
c01059a2:	e8 09 d1 ff ff       	call   c0102ab0 <__panic>

    assert((p0 = alloc_pages(8)) != NULL);
c01059a7:	c7 04 24 08 00 00 00 	movl   $0x8,(%esp)
c01059ae:	e8 1b 06 00 00       	call   c0105fce <alloc_pages>
c01059b3:	89 85 4c ff ff ff    	mov    %eax,-0xb4(%ebp)
c01059b9:	83 bd 4c ff ff ff 00 	cmpl   $0x0,-0xb4(%ebp)
c01059c0:	75 24                	jne    c01059e6 <buddy_check+0x893>
c01059c2:	c7 44 24 0c 6e c0 10 	movl   $0xc010c06e,0xc(%esp)
c01059c9:	c0 
c01059ca:	c7 44 24 08 91 bd 10 	movl   $0xc010bd91,0x8(%esp)
c01059d1:	c0 
c01059d2:	c7 44 24 04 20 01 00 	movl   $0x120,0x4(%esp)
c01059d9:	00 
c01059da:	c7 04 24 a6 bd 10 c0 	movl   $0xc010bda6,(%esp)
c01059e1:	e8 ca d0 ff ff       	call   c0102ab0 <__panic>
    assert(alloc_page() == NULL && nr_free_pages() == 0);
c01059e6:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
c01059ed:	e8 dc 05 00 00       	call   c0105fce <alloc_pages>
c01059f2:	85 c0                	test   %eax,%eax
c01059f4:	75 09                	jne    c01059ff <buddy_check+0x8ac>
c01059f6:	e8 36 06 00 00       	call   c0106031 <nr_free_pages>
c01059fb:	85 c0                	test   %eax,%eax
c01059fd:	74 24                	je     c0105a23 <buddy_check+0x8d0>
c01059ff:	c7 44 24 0c 8c c0 10 	movl   $0xc010c08c,0xc(%esp)
c0105a06:	c0 
c0105a07:	c7 44 24 08 91 bd 10 	movl   $0xc010bd91,0x8(%esp)
c0105a0e:	c0 
c0105a0f:	c7 44 24 04 21 01 00 	movl   $0x121,0x4(%esp)
c0105a16:	00 
c0105a17:	c7 04 24 a6 bd 10 c0 	movl   $0xc010bda6,(%esp)
c0105a1e:	e8 8d d0 ff ff       	call   c0102ab0 <__panic>

    for (i = 0; i <= MAX_ORDER; i ++) {
c0105a23:	c7 85 40 ff ff ff 00 	movl   $0x0,-0xc0(%ebp)
c0105a2a:	00 00 00 
c0105a2d:	eb 58                	jmp    c0105a87 <buddy_check+0x934>
        free_list(i) = free_lists_store[i];
c0105a2f:	8b 95 40 ff ff ff    	mov    -0xc0(%ebp),%edx
c0105a35:	8b 8d 40 ff ff ff    	mov    -0xc0(%ebp),%ecx
c0105a3b:	89 d0                	mov    %edx,%eax
c0105a3d:	01 c0                	add    %eax,%eax
c0105a3f:	01 d0                	add    %edx,%eax
c0105a41:	c1 e0 02             	shl    $0x2,%eax
c0105a44:	8b 94 cd e8 fe ff ff 	mov    -0x118(%ebp,%ecx,8),%edx
c0105a4b:	8b 8c cd ec fe ff ff 	mov    -0x114(%ebp,%ecx,8),%ecx
c0105a52:	89 90 60 89 12 c0    	mov    %edx,-0x3fed76a0(%eax)
c0105a58:	89 88 64 89 12 c0    	mov    %ecx,-0x3fed769c(%eax)
        nr_free(i) = nr_free_store[i];
c0105a5e:	8b 95 40 ff ff ff    	mov    -0xc0(%ebp),%edx
c0105a64:	8b 85 40 ff ff ff    	mov    -0xc0(%ebp),%eax
c0105a6a:	8b 8c 85 bc fe ff ff 	mov    -0x144(%ebp,%eax,4),%ecx
c0105a71:	89 d0                	mov    %edx,%eax
c0105a73:	01 c0                	add    %eax,%eax
c0105a75:	01 d0                	add    %edx,%eax
c0105a77:	c1 e0 02             	shl    $0x2,%eax
c0105a7a:	89 88 68 89 12 c0    	mov    %ecx,-0x3fed7698(%eax)
    assert(PageProperty(p0) && p0->property == 3);

    assert((p0 = alloc_pages(8)) != NULL);
    assert(alloc_page() == NULL && nr_free_pages() == 0);

    for (i = 0; i <= MAX_ORDER; i ++) {
c0105a80:	83 85 40 ff ff ff 01 	addl   $0x1,-0xc0(%ebp)
c0105a87:	83 bd 40 ff ff ff 0a 	cmpl   $0xa,-0xc0(%ebp)
c0105a8e:	7e 9f                	jle    c0105a2f <buddy_check+0x8dc>
        free_list(i) = free_lists_store[i];
        nr_free(i) = nr_free_store[i];
    }

    free_pages(p0, 8);
c0105a90:	c7 44 24 04 08 00 00 	movl   $0x8,0x4(%esp)
c0105a97:	00 
c0105a98:	8b 85 4c ff ff ff    	mov    -0xb4(%ebp),%eax
c0105a9e:	89 04 24             	mov    %eax,(%esp)
c0105aa1:	e8 59 05 00 00       	call   c0105fff <free_pages>
    free_pages(buddy, 8);
c0105aa6:	c7 44 24 04 08 00 00 	movl   $0x8,0x4(%esp)
c0105aad:	00 
c0105aae:	8b 85 50 ff ff ff    	mov    -0xb0(%ebp),%eax
c0105ab4:	89 04 24             	mov    %eax,(%esp)
c0105ab7:	e8 43 05 00 00       	call   c0105fff <free_pages>

    assert(total == nr_free_pages());
c0105abc:	8b 9d 48 ff ff ff    	mov    -0xb8(%ebp),%ebx
c0105ac2:	e8 6a 05 00 00       	call   c0106031 <nr_free_pages>
c0105ac7:	39 c3                	cmp    %eax,%ebx
c0105ac9:	74 24                	je     c0105aef <buddy_check+0x99c>
c0105acb:	c7 44 24 0c 6c be 10 	movl   $0xc010be6c,0xc(%esp)
c0105ad2:	c0 
c0105ad3:	c7 44 24 08 91 bd 10 	movl   $0xc010bd91,0x8(%esp)
c0105ada:	c0 
c0105adb:	c7 44 24 04 2b 01 00 	movl   $0x12b,0x4(%esp)
c0105ae2:	00 
c0105ae3:	c7 04 24 a6 bd 10 c0 	movl   $0xc010bda6,(%esp)
c0105aea:	e8 c1 cf ff ff       	call   c0102ab0 <__panic>

    for (i = 0; i <= MAX_ORDER; i ++) {
c0105aef:	c7 85 40 ff ff ff 00 	movl   $0x0,-0xc0(%ebp)
c0105af6:	00 00 00 
c0105af9:	e9 ee 00 00 00       	jmp    c0105bec <buddy_check+0xa99>
        list_entry_t *list = &free_list(i), *le = list;
c0105afe:	8b 95 40 ff ff ff    	mov    -0xc0(%ebp),%edx
c0105b04:	89 d0                	mov    %edx,%eax
c0105b06:	01 c0                	add    %eax,%eax
c0105b08:	01 d0                	add    %edx,%eax
c0105b0a:	c1 e0 02             	shl    $0x2,%eax
c0105b0d:	05 60 89 12 c0       	add    $0xc0128960,%eax
c0105b12:	89 85 64 ff ff ff    	mov    %eax,-0x9c(%ebp)
c0105b18:	8b 85 64 ff ff ff    	mov    -0x9c(%ebp),%eax
c0105b1e:	89 85 68 ff ff ff    	mov    %eax,-0x98(%ebp)
        while ((le = list_next(le)) != list) {
c0105b24:	e9 95 00 00 00       	jmp    c0105bbe <buddy_check+0xa6b>
            struct Page *p = le2page(le, page_link);
c0105b29:	8b 85 68 ff ff ff    	mov    -0x98(%ebp),%eax
c0105b2f:	83 e8 10             	sub    $0x10,%eax
c0105b32:	89 85 6c ff ff ff    	mov    %eax,-0x94(%ebp)
            assert(PageProperty(p) && p->property == i);
c0105b38:	8b 85 6c ff ff ff    	mov    -0x94(%ebp),%eax
c0105b3e:	83 c0 04             	add    $0x4,%eax
c0105b41:	c7 45 ec 01 00 00 00 	movl   $0x1,-0x14(%ebp)
c0105b48:	89 45 e8             	mov    %eax,-0x18(%ebp)
 * @addr:   the address to count from
 * */
static inline bool
test_bit(int nr, volatile void *addr) {
    int oldbit;
    asm volatile ("btl %2, %1; sbbl %0,%0" : "=r" (oldbit) : "m" (*(volatile long *)addr), "Ir" (nr));
c0105b4b:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0105b4e:	8b 55 ec             	mov    -0x14(%ebp),%edx
c0105b51:	0f a3 10             	bt     %edx,(%eax)
c0105b54:	19 c0                	sbb    %eax,%eax
c0105b56:	89 45 f0             	mov    %eax,-0x10(%ebp)
    return oldbit != 0;
c0105b59:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
c0105b5d:	0f 95 c0             	setne  %al
c0105b60:	0f b6 c0             	movzbl %al,%eax
c0105b63:	85 c0                	test   %eax,%eax
c0105b65:	74 13                	je     c0105b7a <buddy_check+0xa27>
c0105b67:	8b 85 6c ff ff ff    	mov    -0x94(%ebp),%eax
c0105b6d:	8b 50 08             	mov    0x8(%eax),%edx
c0105b70:	8b 85 40 ff ff ff    	mov    -0xc0(%ebp),%eax
c0105b76:	39 c2                	cmp    %eax,%edx
c0105b78:	74 24                	je     c0105b9e <buddy_check+0xa4b>
c0105b7a:	c7 44 24 0c 48 be 10 	movl   $0xc010be48,0xc(%esp)
c0105b81:	c0 
c0105b82:	c7 44 24 08 91 bd 10 	movl   $0xc010bd91,0x8(%esp)
c0105b89:	c0 
c0105b8a:	c7 44 24 04 31 01 00 	movl   $0x131,0x4(%esp)
c0105b91:	00 
c0105b92:	c7 04 24 a6 bd 10 c0 	movl   $0xc010bda6,(%esp)
c0105b99:	e8 12 cf ff ff       	call   c0102ab0 <__panic>
            count --, total -= (1 << i);
c0105b9e:	83 ad 44 ff ff ff 01 	subl   $0x1,-0xbc(%ebp)
c0105ba5:	8b 85 40 ff ff ff    	mov    -0xc0(%ebp),%eax
c0105bab:	ba 01 00 00 00       	mov    $0x1,%edx
c0105bb0:	89 d3                	mov    %edx,%ebx
c0105bb2:	89 c1                	mov    %eax,%ecx
c0105bb4:	d3 e3                	shl    %cl,%ebx
c0105bb6:	89 d8                	mov    %ebx,%eax
c0105bb8:	29 85 48 ff ff ff    	sub    %eax,-0xb8(%ebp)
c0105bbe:	8b 85 68 ff ff ff    	mov    -0x98(%ebp),%eax
c0105bc4:	89 45 f4             	mov    %eax,-0xc(%ebp)
 * list_next - get the next entry
 * @listelm:    the list head
 **/
static list_entry_t *
list_next(list_entry_t *listelm) {
    return listelm->next;
c0105bc7:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0105bca:	8b 40 04             	mov    0x4(%eax),%eax

    assert(total == nr_free_pages());

    for (i = 0; i <= MAX_ORDER; i ++) {
        list_entry_t *list = &free_list(i), *le = list;
        while ((le = list_next(le)) != list) {
c0105bcd:	89 85 68 ff ff ff    	mov    %eax,-0x98(%ebp)
c0105bd3:	8b 85 68 ff ff ff    	mov    -0x98(%ebp),%eax
c0105bd9:	3b 85 64 ff ff ff    	cmp    -0x9c(%ebp),%eax
c0105bdf:	0f 85 44 ff ff ff    	jne    c0105b29 <buddy_check+0x9d6>
    free_pages(p0, 8);
    free_pages(buddy, 8);

    assert(total == nr_free_pages());

    for (i = 0; i <= MAX_ORDER; i ++) {
c0105be5:	83 85 40 ff ff ff 01 	addl   $0x1,-0xc0(%ebp)
c0105bec:	83 bd 40 ff ff ff 0a 	cmpl   $0xa,-0xc0(%ebp)
c0105bf3:	0f 8e 05 ff ff ff    	jle    c0105afe <buddy_check+0x9ab>
            struct Page *p = le2page(le, page_link);
            assert(PageProperty(p) && p->property == i);
            count --, total -= (1 << i);
        }
    }
    assert(count == 0);
c0105bf9:	83 bd 44 ff ff ff 00 	cmpl   $0x0,-0xbc(%ebp)
c0105c00:	74 24                	je     c0105c26 <buddy_check+0xad3>
c0105c02:	c7 44 24 0c b9 c0 10 	movl   $0xc010c0b9,0xc(%esp)
c0105c09:	c0 
c0105c0a:	c7 44 24 08 91 bd 10 	movl   $0xc010bd91,0x8(%esp)
c0105c11:	c0 
c0105c12:	c7 44 24 04 35 01 00 	movl   $0x135,0x4(%esp)
c0105c19:	00 
c0105c1a:	c7 04 24 a6 bd 10 c0 	movl   $0xc010bda6,(%esp)
c0105c21:	e8 8a ce ff ff       	call   c0102ab0 <__panic>
    assert(total == 0);
c0105c26:	83 bd 48 ff ff ff 00 	cmpl   $0x0,-0xb8(%ebp)
c0105c2d:	74 24                	je     c0105c53 <buddy_check+0xb00>
c0105c2f:	c7 44 24 0c c4 c0 10 	movl   $0xc010c0c4,0xc(%esp)
c0105c36:	c0 
c0105c37:	c7 44 24 08 91 bd 10 	movl   $0xc010bd91,0x8(%esp)
c0105c3e:	c0 
c0105c3f:	c7 44 24 04 36 01 00 	movl   $0x136,0x4(%esp)
c0105c46:	00 
c0105c47:	c7 04 24 a6 bd 10 c0 	movl   $0xc010bda6,(%esp)
c0105c4e:	e8 5d ce ff ff       	call   c0102ab0 <__panic>
}
c0105c53:	81 c4 54 01 00 00    	add    $0x154,%esp
c0105c59:	5b                   	pop    %ebx
c0105c5a:	5d                   	pop    %ebp
c0105c5b:	c3                   	ret    

c0105c5c <page2ppn>:

extern struct Page *pages;
extern size_t npage;

static inline ppn_t
page2ppn(struct Page *page) {
c0105c5c:	55                   	push   %ebp
c0105c5d:	89 e5                	mov    %esp,%ebp
    return page - pages;
c0105c5f:	8b 55 08             	mov    0x8(%ebp),%edx
c0105c62:	a1 b4 8c 12 c0       	mov    0xc0128cb4,%eax
c0105c67:	89 d1                	mov    %edx,%ecx
c0105c69:	29 c1                	sub    %eax,%ecx
c0105c6b:	89 c8                	mov    %ecx,%eax
c0105c6d:	c1 f8 03             	sar    $0x3,%eax
c0105c70:	69 c0 ab aa aa aa    	imul   $0xaaaaaaab,%eax,%eax
}
c0105c76:	5d                   	pop    %ebp
c0105c77:	c3                   	ret    

c0105c78 <page2pa>:

static inline uintptr_t
page2pa(struct Page *page) {
c0105c78:	55                   	push   %ebp
c0105c79:	89 e5                	mov    %esp,%ebp
c0105c7b:	83 ec 04             	sub    $0x4,%esp
    return page2ppn(page) << PGSHIFT;
c0105c7e:	8b 45 08             	mov    0x8(%ebp),%eax
c0105c81:	89 04 24             	mov    %eax,(%esp)
c0105c84:	e8 d3 ff ff ff       	call   c0105c5c <page2ppn>
c0105c89:	c1 e0 0c             	shl    $0xc,%eax
}
c0105c8c:	c9                   	leave  
c0105c8d:	c3                   	ret    

c0105c8e <pa2page>:

static inline struct Page *
pa2page(uintptr_t pa) {
c0105c8e:	55                   	push   %ebp
c0105c8f:	89 e5                	mov    %esp,%ebp
c0105c91:	83 ec 18             	sub    $0x18,%esp
    if (PPN(pa) >= npage) {
c0105c94:	8b 45 08             	mov    0x8(%ebp),%eax
c0105c97:	89 c2                	mov    %eax,%edx
c0105c99:	c1 ea 0c             	shr    $0xc,%edx
c0105c9c:	a1 00 8a 12 c0       	mov    0xc0128a00,%eax
c0105ca1:	39 c2                	cmp    %eax,%edx
c0105ca3:	72 1c                	jb     c0105cc1 <pa2page+0x33>
        panic("pa2page called with invalid pa");
c0105ca5:	c7 44 24 08 00 c1 10 	movl   $0xc010c100,0x8(%esp)
c0105cac:	c0 
c0105cad:	c7 44 24 04 5b 00 00 	movl   $0x5b,0x4(%esp)
c0105cb4:	00 
c0105cb5:	c7 04 24 1f c1 10 c0 	movl   $0xc010c11f,(%esp)
c0105cbc:	e8 ef cd ff ff       	call   c0102ab0 <__panic>
    }
    return &pages[PPN(pa)];
c0105cc1:	8b 0d b4 8c 12 c0    	mov    0xc0128cb4,%ecx
c0105cc7:	8b 45 08             	mov    0x8(%ebp),%eax
c0105cca:	89 c2                	mov    %eax,%edx
c0105ccc:	c1 ea 0c             	shr    $0xc,%edx
c0105ccf:	89 d0                	mov    %edx,%eax
c0105cd1:	01 c0                	add    %eax,%eax
c0105cd3:	01 d0                	add    %edx,%eax
c0105cd5:	c1 e0 03             	shl    $0x3,%eax
c0105cd8:	8d 04 01             	lea    (%ecx,%eax,1),%eax
}
c0105cdb:	c9                   	leave  
c0105cdc:	c3                   	ret    

c0105cdd <page2kva>:

static inline void *
page2kva(struct Page *page) {
c0105cdd:	55                   	push   %ebp
c0105cde:	89 e5                	mov    %esp,%ebp
c0105ce0:	83 ec 28             	sub    $0x28,%esp
    return KADDR(page2pa(page));
c0105ce3:	8b 45 08             	mov    0x8(%ebp),%eax
c0105ce6:	89 04 24             	mov    %eax,(%esp)
c0105ce9:	e8 8a ff ff ff       	call   c0105c78 <page2pa>
c0105cee:	89 45 f0             	mov    %eax,-0x10(%ebp)
c0105cf1:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0105cf4:	c1 e8 0c             	shr    $0xc,%eax
c0105cf7:	89 45 f4             	mov    %eax,-0xc(%ebp)
c0105cfa:	a1 00 8a 12 c0       	mov    0xc0128a00,%eax
c0105cff:	39 45 f4             	cmp    %eax,-0xc(%ebp)
c0105d02:	72 23                	jb     c0105d27 <page2kva+0x4a>
c0105d04:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0105d07:	89 44 24 0c          	mov    %eax,0xc(%esp)
c0105d0b:	c7 44 24 08 30 c1 10 	movl   $0xc010c130,0x8(%esp)
c0105d12:	c0 
c0105d13:	c7 44 24 04 62 00 00 	movl   $0x62,0x4(%esp)
c0105d1a:	00 
c0105d1b:	c7 04 24 1f c1 10 c0 	movl   $0xc010c11f,(%esp)
c0105d22:	e8 89 cd ff ff       	call   c0102ab0 <__panic>
c0105d27:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0105d2a:	2d 00 00 00 40       	sub    $0x40000000,%eax
}
c0105d2f:	c9                   	leave  
c0105d30:	c3                   	ret    

c0105d31 <pte2page>:
kva2page(void *kva) {
    return pa2page(PADDR(kva));
}

static inline struct Page *
pte2page(pte_t pte) {
c0105d31:	55                   	push   %ebp
c0105d32:	89 e5                	mov    %esp,%ebp
c0105d34:	83 ec 18             	sub    $0x18,%esp
    if (!(pte & PTE_P)) {
c0105d37:	8b 45 08             	mov    0x8(%ebp),%eax
c0105d3a:	83 e0 01             	and    $0x1,%eax
c0105d3d:	85 c0                	test   %eax,%eax
c0105d3f:	75 1c                	jne    c0105d5d <pte2page+0x2c>
        panic("pte2page called with invalid pte");
c0105d41:	c7 44 24 08 54 c1 10 	movl   $0xc010c154,0x8(%esp)
c0105d48:	c0 
c0105d49:	c7 44 24 04 6d 00 00 	movl   $0x6d,0x4(%esp)
c0105d50:	00 
c0105d51:	c7 04 24 1f c1 10 c0 	movl   $0xc010c11f,(%esp)
c0105d58:	e8 53 cd ff ff       	call   c0102ab0 <__panic>
    }
    return pa2page(PTE_ADDR(pte));
c0105d5d:	8b 45 08             	mov    0x8(%ebp),%eax
c0105d60:	25 00 f0 ff ff       	and    $0xfffff000,%eax
c0105d65:	89 04 24             	mov    %eax,(%esp)
c0105d68:	e8 21 ff ff ff       	call   c0105c8e <pa2page>
}
c0105d6d:	c9                   	leave  
c0105d6e:	c3                   	ret    

c0105d6f <page_ref>:
pde2page(pde_t pde) {
    return pa2page(PDE_ADDR(pde));
}

static inline int
page_ref(struct Page *page) {
c0105d6f:	55                   	push   %ebp
c0105d70:	89 e5                	mov    %esp,%ebp
c0105d72:	83 ec 10             	sub    $0x10,%esp
    return atomic_read(&(page->ref));
c0105d75:	8b 45 08             	mov    0x8(%ebp),%eax
c0105d78:	89 45 fc             	mov    %eax,-0x4(%ebp)
 *
 * Atomically reads the value of @v.
 * */
static inline int
atomic_read(const atomic_t *v) {
    return v->counter;
c0105d7b:	8b 45 fc             	mov    -0x4(%ebp),%eax
c0105d7e:	8b 00                	mov    (%eax),%eax
}
c0105d80:	c9                   	leave  
c0105d81:	c3                   	ret    

c0105d82 <set_page_ref>:

static inline void
set_page_ref(struct Page *page, int val) {
c0105d82:	55                   	push   %ebp
c0105d83:	89 e5                	mov    %esp,%ebp
c0105d85:	83 ec 10             	sub    $0x10,%esp
    atomic_set(&(page->ref), val);
c0105d88:	8b 45 08             	mov    0x8(%ebp),%eax
c0105d8b:	89 45 fc             	mov    %eax,-0x4(%ebp)
c0105d8e:	8b 45 0c             	mov    0xc(%ebp),%eax
c0105d91:	89 45 f8             	mov    %eax,-0x8(%ebp)
 *
 * Atomically sets the value of @v to @i.
 * */
static inline void
atomic_set(atomic_t *v, int i) {
    v->counter = i;
c0105d94:	8b 45 fc             	mov    -0x4(%ebp),%eax
c0105d97:	8b 55 f8             	mov    -0x8(%ebp),%edx
c0105d9a:	89 10                	mov    %edx,(%eax)
}
c0105d9c:	c9                   	leave  
c0105d9d:	c3                   	ret    

c0105d9e <page_ref_inc>:

static inline int
page_ref_inc(struct Page *page) {
c0105d9e:	55                   	push   %ebp
c0105d9f:	89 e5                	mov    %esp,%ebp
c0105da1:	83 ec 10             	sub    $0x10,%esp
    return atomic_add_return(&(page->ref), 1);
c0105da4:	8b 45 08             	mov    0x8(%ebp),%eax
c0105da7:	89 45 f8             	mov    %eax,-0x8(%ebp)
c0105daa:	c7 45 f4 01 00 00 00 	movl   $0x1,-0xc(%ebp)
 * Atomically adds @i to @v and returns @i + @v
 * Requires Modern 486+ processor
 * */
static inline int
atomic_add_return(atomic_t *v, int i) {
    int __i = i;
c0105db1:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0105db4:	89 45 fc             	mov    %eax,-0x4(%ebp)
    asm volatile("xaddl %0, %1" : "+r" (i), "+m" (v->counter) :: "memory");
c0105db7:	8b 55 f8             	mov    -0x8(%ebp),%edx
c0105dba:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0105dbd:	0f c1 02             	xadd   %eax,(%edx)
c0105dc0:	89 45 f4             	mov    %eax,-0xc(%ebp)
    return i + __i;
c0105dc3:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0105dc6:	8b 55 fc             	mov    -0x4(%ebp),%edx
c0105dc9:	8d 04 02             	lea    (%edx,%eax,1),%eax
}
c0105dcc:	c9                   	leave  
c0105dcd:	c3                   	ret    

c0105dce <page_ref_dec>:

static inline int
page_ref_dec(struct Page *page) {
c0105dce:	55                   	push   %ebp
c0105dcf:	89 e5                	mov    %esp,%ebp
c0105dd1:	83 ec 20             	sub    $0x20,%esp
    return atomic_sub_return(&(page->ref), 1);
c0105dd4:	8b 45 08             	mov    0x8(%ebp),%eax
c0105dd7:	89 45 f0             	mov    %eax,-0x10(%ebp)
c0105dda:	c7 45 ec 01 00 00 00 	movl   $0x1,-0x14(%ebp)
 *
 * Atomically subtracts @i from @v and returns @v - @i
 * */
static inline int
atomic_sub_return(atomic_t *v, int i) {
    return atomic_add_return(v, -i);
c0105de1:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0105de4:	89 c2                	mov    %eax,%edx
c0105de6:	f7 da                	neg    %edx
c0105de8:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0105deb:	89 45 f8             	mov    %eax,-0x8(%ebp)
c0105dee:	89 55 f4             	mov    %edx,-0xc(%ebp)
 * Atomically adds @i to @v and returns @i + @v
 * Requires Modern 486+ processor
 * */
static inline int
atomic_add_return(atomic_t *v, int i) {
    int __i = i;
c0105df1:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0105df4:	89 45 fc             	mov    %eax,-0x4(%ebp)
    asm volatile("xaddl %0, %1" : "+r" (i), "+m" (v->counter) :: "memory");
c0105df7:	8b 55 f8             	mov    -0x8(%ebp),%edx
c0105dfa:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0105dfd:	0f c1 02             	xadd   %eax,(%edx)
c0105e00:	89 45 f4             	mov    %eax,-0xc(%ebp)
    return i + __i;
c0105e03:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0105e06:	8b 55 fc             	mov    -0x4(%ebp),%edx
c0105e09:	8d 04 02             	lea    (%edx,%eax,1),%eax
}
c0105e0c:	c9                   	leave  
c0105e0d:	c3                   	ret    

c0105e0e <__intr_save>:
#include <x86.h>
#include <intr.h>
#include <mmu.h>

static inline bool
__intr_save(void) {
c0105e0e:	55                   	push   %ebp
c0105e0f:	89 e5                	mov    %esp,%ebp
c0105e11:	83 ec 18             	sub    $0x18,%esp
}

static inline uint32_t
read_eflags(void) {
    uint32_t eflags;
    asm volatile ("pushfl; popl %0" : "=r" (eflags));
c0105e14:	9c                   	pushf  
c0105e15:	58                   	pop    %eax
c0105e16:	89 45 f4             	mov    %eax,-0xc(%ebp)
    return eflags;
c0105e19:	8b 45 f4             	mov    -0xc(%ebp),%eax
    if (read_eflags() & FL_IF) {
c0105e1c:	25 00 02 00 00       	and    $0x200,%eax
c0105e21:	85 c0                	test   %eax,%eax
c0105e23:	74 0c                	je     c0105e31 <__intr_save+0x23>
        intr_disable();
c0105e25:	e8 78 d6 ff ff       	call   c01034a2 <intr_disable>
        return 1;
c0105e2a:	b8 01 00 00 00       	mov    $0x1,%eax
c0105e2f:	eb 05                	jmp    c0105e36 <__intr_save+0x28>
    }
    return 0;
c0105e31:	b8 00 00 00 00       	mov    $0x0,%eax
}
c0105e36:	c9                   	leave  
c0105e37:	c3                   	ret    

c0105e38 <__intr_restore>:

static inline void
__intr_restore(bool flag) {
c0105e38:	55                   	push   %ebp
c0105e39:	89 e5                	mov    %esp,%ebp
c0105e3b:	83 ec 08             	sub    $0x8,%esp
    if (flag) {
c0105e3e:	83 7d 08 00          	cmpl   $0x0,0x8(%ebp)
c0105e42:	74 05                	je     c0105e49 <__intr_restore+0x11>
        intr_enable();
c0105e44:	e8 53 d6 ff ff       	call   c010349c <intr_enable>
    }
}
c0105e49:	c9                   	leave  
c0105e4a:	c3                   	ret    

c0105e4b <lgdt>:
/* *
 * lgdt - load the global descriptor table register and reset the
 * data/code segement registers for kernel.
 * */
static inline void
lgdt(struct pseudodesc *pd) {
c0105e4b:	55                   	push   %ebp
c0105e4c:	89 e5                	mov    %esp,%ebp
    asm volatile ("lgdt (%0)" :: "r" (pd));
c0105e4e:	8b 45 08             	mov    0x8(%ebp),%eax
c0105e51:	0f 01 10             	lgdtl  (%eax)
    asm volatile ("movw %%ax, %%gs" :: "a" (USER_DS));
c0105e54:	b8 23 00 00 00       	mov    $0x23,%eax
c0105e59:	8e e8                	mov    %eax,%gs
    asm volatile ("movw %%ax, %%fs" :: "a" (USER_DS));
c0105e5b:	b8 23 00 00 00       	mov    $0x23,%eax
c0105e60:	8e e0                	mov    %eax,%fs
    asm volatile ("movw %%ax, %%es" :: "a" (KERNEL_DS));
c0105e62:	b8 10 00 00 00       	mov    $0x10,%eax
c0105e67:	8e c0                	mov    %eax,%es
    asm volatile ("movw %%ax, %%ds" :: "a" (KERNEL_DS));
c0105e69:	b8 10 00 00 00       	mov    $0x10,%eax
c0105e6e:	8e d8                	mov    %eax,%ds
    asm volatile ("movw %%ax, %%ss" :: "a" (KERNEL_DS));
c0105e70:	b8 10 00 00 00       	mov    $0x10,%eax
c0105e75:	8e d0                	mov    %eax,%ss
    // reload cs
    asm volatile ("ljmp %0, $1f\n 1:\n" :: "i" (KERNEL_CS));
c0105e77:	ea 7e 5e 10 c0 08 00 	ljmp   $0x8,$0xc0105e7e
}
c0105e7e:	5d                   	pop    %ebp
c0105e7f:	c3                   	ret    

c0105e80 <load_esp0>:
 * load_esp0 - change the ESP0 in default task state segment,
 * so that we can use different kernel stack when we trap frame
 * user to kernel.
 * */
void
load_esp0(uintptr_t esp0) {
c0105e80:	55                   	push   %ebp
c0105e81:	89 e5                	mov    %esp,%ebp
    ts.ts_esp0 = esp0;
c0105e83:	8b 45 08             	mov    0x8(%ebp),%eax
c0105e86:	a3 24 8a 12 c0       	mov    %eax,0xc0128a24
}
c0105e8b:	5d                   	pop    %ebp
c0105e8c:	c3                   	ret    

c0105e8d <gdt_init>:

/* gdt_init - initialize the default GDT and TSS */
static void
gdt_init(void) {
c0105e8d:	55                   	push   %ebp
c0105e8e:	89 e5                	mov    %esp,%ebp
c0105e90:	83 ec 14             	sub    $0x14,%esp
    // set boot kernel stack and default SS0
    load_esp0((uintptr_t)bootstacktop);
c0105e93:	b8 00 70 12 c0       	mov    $0xc0127000,%eax
c0105e98:	89 04 24             	mov    %eax,(%esp)
c0105e9b:	e8 e0 ff ff ff       	call   c0105e80 <load_esp0>
    ts.ts_ss0 = KERNEL_DS;
c0105ea0:	66 c7 05 28 8a 12 c0 	movw   $0x10,0xc0128a28
c0105ea7:	10 00 

    // initialize the TSS filed of the gdt
    gdt[SEG_TSS] = SEGTSS(STS_T32A, (uintptr_t)&ts, sizeof(ts), DPL_KERNEL);
c0105ea9:	66 c7 05 88 7a 12 c0 	movw   $0x68,0xc0127a88
c0105eb0:	68 00 
c0105eb2:	b8 20 8a 12 c0       	mov    $0xc0128a20,%eax
c0105eb7:	66 a3 8a 7a 12 c0    	mov    %ax,0xc0127a8a
c0105ebd:	b8 20 8a 12 c0       	mov    $0xc0128a20,%eax
c0105ec2:	c1 e8 10             	shr    $0x10,%eax
c0105ec5:	a2 8c 7a 12 c0       	mov    %al,0xc0127a8c
c0105eca:	0f b6 05 8d 7a 12 c0 	movzbl 0xc0127a8d,%eax
c0105ed1:	83 e0 f0             	and    $0xfffffff0,%eax
c0105ed4:	83 c8 09             	or     $0x9,%eax
c0105ed7:	a2 8d 7a 12 c0       	mov    %al,0xc0127a8d
c0105edc:	0f b6 05 8d 7a 12 c0 	movzbl 0xc0127a8d,%eax
c0105ee3:	83 e0 ef             	and    $0xffffffef,%eax
c0105ee6:	a2 8d 7a 12 c0       	mov    %al,0xc0127a8d
c0105eeb:	0f b6 05 8d 7a 12 c0 	movzbl 0xc0127a8d,%eax
c0105ef2:	83 e0 9f             	and    $0xffffff9f,%eax
c0105ef5:	a2 8d 7a 12 c0       	mov    %al,0xc0127a8d
c0105efa:	0f b6 05 8d 7a 12 c0 	movzbl 0xc0127a8d,%eax
c0105f01:	83 c8 80             	or     $0xffffff80,%eax
c0105f04:	a2 8d 7a 12 c0       	mov    %al,0xc0127a8d
c0105f09:	0f b6 05 8e 7a 12 c0 	movzbl 0xc0127a8e,%eax
c0105f10:	83 e0 f0             	and    $0xfffffff0,%eax
c0105f13:	a2 8e 7a 12 c0       	mov    %al,0xc0127a8e
c0105f18:	0f b6 05 8e 7a 12 c0 	movzbl 0xc0127a8e,%eax
c0105f1f:	83 e0 ef             	and    $0xffffffef,%eax
c0105f22:	a2 8e 7a 12 c0       	mov    %al,0xc0127a8e
c0105f27:	0f b6 05 8e 7a 12 c0 	movzbl 0xc0127a8e,%eax
c0105f2e:	83 e0 df             	and    $0xffffffdf,%eax
c0105f31:	a2 8e 7a 12 c0       	mov    %al,0xc0127a8e
c0105f36:	0f b6 05 8e 7a 12 c0 	movzbl 0xc0127a8e,%eax
c0105f3d:	83 c8 40             	or     $0x40,%eax
c0105f40:	a2 8e 7a 12 c0       	mov    %al,0xc0127a8e
c0105f45:	0f b6 05 8e 7a 12 c0 	movzbl 0xc0127a8e,%eax
c0105f4c:	83 e0 7f             	and    $0x7f,%eax
c0105f4f:	a2 8e 7a 12 c0       	mov    %al,0xc0127a8e
c0105f54:	b8 20 8a 12 c0       	mov    $0xc0128a20,%eax
c0105f59:	c1 e8 18             	shr    $0x18,%eax
c0105f5c:	a2 8f 7a 12 c0       	mov    %al,0xc0127a8f

    // reload all segment registers
    lgdt(&gdt_pd);
c0105f61:	c7 04 24 90 7a 12 c0 	movl   $0xc0127a90,(%esp)
c0105f68:	e8 de fe ff ff       	call   c0105e4b <lgdt>
c0105f6d:	66 c7 45 fe 28 00    	movw   $0x28,-0x2(%ebp)
    asm volatile ("cli");
}

static inline void
ltr(uint16_t sel) {
    asm volatile ("ltr %0" :: "r" (sel));
c0105f73:	0f b7 45 fe          	movzwl -0x2(%ebp),%eax
c0105f77:	0f 00 d8             	ltr    %ax

    // load the TSS
    ltr(GD_TSS);
}
c0105f7a:	c9                   	leave  
c0105f7b:	c3                   	ret    

c0105f7c <init_pmm_manager>:

//init_pmm_manager - initialize a pmm_manager instance
static void
init_pmm_manager(void) {
c0105f7c:	55                   	push   %ebp
c0105f7d:	89 e5                	mov    %esp,%ebp
c0105f7f:	83 ec 18             	sub    $0x18,%esp
    pmm_manager = &buddy_pmm_manager;
c0105f82:	c7 05 ac 8c 12 c0 e4 	movl   $0xc010c0e4,0xc0128cac
c0105f89:	c0 10 c0 
    cprintf("memory managment: %s\n", pmm_manager->name);
c0105f8c:	a1 ac 8c 12 c0       	mov    0xc0128cac,%eax
c0105f91:	8b 00                	mov    (%eax),%eax
c0105f93:	89 44 24 04          	mov    %eax,0x4(%esp)
c0105f97:	c7 04 24 80 c1 10 c0 	movl   $0xc010c180,(%esp)
c0105f9e:	e8 29 b6 ff ff       	call   c01015cc <cprintf>
    pmm_manager->init();
c0105fa3:	a1 ac 8c 12 c0       	mov    0xc0128cac,%eax
c0105fa8:	8b 40 04             	mov    0x4(%eax),%eax
c0105fab:	ff d0                	call   *%eax
}
c0105fad:	c9                   	leave  
c0105fae:	c3                   	ret    

c0105faf <init_memmap>:

//init_memmap - call pmm->init_memmap to build Page struct for free memory  
static void
init_memmap(struct Page *base, size_t n) {
c0105faf:	55                   	push   %ebp
c0105fb0:	89 e5                	mov    %esp,%ebp
c0105fb2:	83 ec 18             	sub    $0x18,%esp
    pmm_manager->init_memmap(base, n);
c0105fb5:	a1 ac 8c 12 c0       	mov    0xc0128cac,%eax
c0105fba:	8b 50 08             	mov    0x8(%eax),%edx
c0105fbd:	8b 45 0c             	mov    0xc(%ebp),%eax
c0105fc0:	89 44 24 04          	mov    %eax,0x4(%esp)
c0105fc4:	8b 45 08             	mov    0x8(%ebp),%eax
c0105fc7:	89 04 24             	mov    %eax,(%esp)
c0105fca:	ff d2                	call   *%edx
}
c0105fcc:	c9                   	leave  
c0105fcd:	c3                   	ret    

c0105fce <alloc_pages>:

//alloc_pages - call pmm->alloc_pages to allocate a continuous n*PAGESIZE memory 
struct Page *
alloc_pages(size_t n) {
c0105fce:	55                   	push   %ebp
c0105fcf:	89 e5                	mov    %esp,%ebp
c0105fd1:	83 ec 28             	sub    $0x28,%esp
    struct Page *page;
    bool intr_flag;
    local_intr_save(intr_flag);
c0105fd4:	e8 35 fe ff ff       	call   c0105e0e <__intr_save>
c0105fd9:	89 45 f4             	mov    %eax,-0xc(%ebp)
    {
        page = pmm_manager->alloc_pages(n);
c0105fdc:	a1 ac 8c 12 c0       	mov    0xc0128cac,%eax
c0105fe1:	8b 50 0c             	mov    0xc(%eax),%edx
c0105fe4:	8b 45 08             	mov    0x8(%ebp),%eax
c0105fe7:	89 04 24             	mov    %eax,(%esp)
c0105fea:	ff d2                	call   *%edx
c0105fec:	89 45 f0             	mov    %eax,-0x10(%ebp)
    }
    local_intr_restore(intr_flag);
c0105fef:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0105ff2:	89 04 24             	mov    %eax,(%esp)
c0105ff5:	e8 3e fe ff ff       	call   c0105e38 <__intr_restore>
    return page;
c0105ffa:	8b 45 f0             	mov    -0x10(%ebp),%eax
}
c0105ffd:	c9                   	leave  
c0105ffe:	c3                   	ret    

c0105fff <free_pages>:

//free_pages - call pmm->free_pages to free a continuous n*PAGESIZE memory 
void
free_pages(struct Page *base, size_t n) {
c0105fff:	55                   	push   %ebp
c0106000:	89 e5                	mov    %esp,%ebp
c0106002:	83 ec 28             	sub    $0x28,%esp
    bool intr_flag;
    local_intr_save(intr_flag);
c0106005:	e8 04 fe ff ff       	call   c0105e0e <__intr_save>
c010600a:	89 45 f4             	mov    %eax,-0xc(%ebp)
    {
        pmm_manager->free_pages(base, n);
c010600d:	a1 ac 8c 12 c0       	mov    0xc0128cac,%eax
c0106012:	8b 50 10             	mov    0x10(%eax),%edx
c0106015:	8b 45 0c             	mov    0xc(%ebp),%eax
c0106018:	89 44 24 04          	mov    %eax,0x4(%esp)
c010601c:	8b 45 08             	mov    0x8(%ebp),%eax
c010601f:	89 04 24             	mov    %eax,(%esp)
c0106022:	ff d2                	call   *%edx
    }
    local_intr_restore(intr_flag);
c0106024:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0106027:	89 04 24             	mov    %eax,(%esp)
c010602a:	e8 09 fe ff ff       	call   c0105e38 <__intr_restore>
}
c010602f:	c9                   	leave  
c0106030:	c3                   	ret    

c0106031 <nr_free_pages>:

//nr_free_pages - call pmm->nr_free_pages to get the size (nr*PAGESIZE) 
//of current free memory
size_t
nr_free_pages(void) {
c0106031:	55                   	push   %ebp
c0106032:	89 e5                	mov    %esp,%ebp
c0106034:	83 ec 28             	sub    $0x28,%esp
    size_t ret;
    bool intr_flag;
    local_intr_save(intr_flag);
c0106037:	e8 d2 fd ff ff       	call   c0105e0e <__intr_save>
c010603c:	89 45 f4             	mov    %eax,-0xc(%ebp)
    {
        ret = pmm_manager->nr_free_pages();
c010603f:	a1 ac 8c 12 c0       	mov    0xc0128cac,%eax
c0106044:	8b 40 14             	mov    0x14(%eax),%eax
c0106047:	ff d0                	call   *%eax
c0106049:	89 45 f0             	mov    %eax,-0x10(%ebp)
    }
    local_intr_restore(intr_flag);
c010604c:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010604f:	89 04 24             	mov    %eax,(%esp)
c0106052:	e8 e1 fd ff ff       	call   c0105e38 <__intr_restore>
    return ret;
c0106057:	8b 45 f0             	mov    -0x10(%ebp),%eax
}
c010605a:	c9                   	leave  
c010605b:	c3                   	ret    

c010605c <page_init>:

/* pmm_init - initialize the physical memory management */
static void
page_init(void) {
c010605c:	55                   	push   %ebp
c010605d:	89 e5                	mov    %esp,%ebp
c010605f:	57                   	push   %edi
c0106060:	56                   	push   %esi
c0106061:	53                   	push   %ebx
c0106062:	81 ec 9c 00 00 00    	sub    $0x9c,%esp
    struct e820map *memmap = (struct e820map *)(0x8000 + KERNBASE);
c0106068:	c7 45 8c 00 80 00 c0 	movl   $0xc0008000,-0x74(%ebp)
    uint64_t maxpa = 0;
c010606f:	c7 45 90 00 00 00 00 	movl   $0x0,-0x70(%ebp)
c0106076:	c7 45 94 00 00 00 00 	movl   $0x0,-0x6c(%ebp)

    cprintf("e820map:\n");
c010607d:	c7 04 24 96 c1 10 c0 	movl   $0xc010c196,(%esp)
c0106084:	e8 43 b5 ff ff       	call   c01015cc <cprintf>
    int i;
    for (i = 0; i < memmap->nr_map; i ++) {
c0106089:	c7 45 98 00 00 00 00 	movl   $0x0,-0x68(%ebp)
c0106090:	e9 11 01 00 00       	jmp    c01061a6 <page_init+0x14a>
        uint64_t begin = memmap->map[i].addr, end = begin + memmap->map[i].size;
c0106095:	8b 55 98             	mov    -0x68(%ebp),%edx
c0106098:	8b 4d 8c             	mov    -0x74(%ebp),%ecx
c010609b:	89 d0                	mov    %edx,%eax
c010609d:	c1 e0 02             	shl    $0x2,%eax
c01060a0:	01 d0                	add    %edx,%eax
c01060a2:	c1 e0 02             	shl    $0x2,%eax
c01060a5:	8b 54 08 08          	mov    0x8(%eax,%ecx,1),%edx
c01060a9:	8b 44 08 04          	mov    0x4(%eax,%ecx,1),%eax
c01060ad:	89 45 a0             	mov    %eax,-0x60(%ebp)
c01060b0:	89 55 a4             	mov    %edx,-0x5c(%ebp)
c01060b3:	8b 55 98             	mov    -0x68(%ebp),%edx
c01060b6:	8b 4d 8c             	mov    -0x74(%ebp),%ecx
c01060b9:	89 d0                	mov    %edx,%eax
c01060bb:	c1 e0 02             	shl    $0x2,%eax
c01060be:	01 d0                	add    %edx,%eax
c01060c0:	c1 e0 02             	shl    $0x2,%eax
c01060c3:	8b 54 08 10          	mov    0x10(%eax,%ecx,1),%edx
c01060c7:	8b 44 08 0c          	mov    0xc(%eax,%ecx,1),%eax
c01060cb:	03 45 a0             	add    -0x60(%ebp),%eax
c01060ce:	13 55 a4             	adc    -0x5c(%ebp),%edx
c01060d1:	89 45 a8             	mov    %eax,-0x58(%ebp)
c01060d4:	89 55 ac             	mov    %edx,-0x54(%ebp)
        cprintf("  memory: %08llx, [%08llx, %08llx], type = %d.\n",
c01060d7:	8b 55 98             	mov    -0x68(%ebp),%edx
c01060da:	8b 4d 8c             	mov    -0x74(%ebp),%ecx
c01060dd:	89 d0                	mov    %edx,%eax
c01060df:	c1 e0 02             	shl    $0x2,%eax
c01060e2:	01 d0                	add    %edx,%eax
c01060e4:	c1 e0 02             	shl    $0x2,%eax
c01060e7:	01 c8                	add    %ecx,%eax
c01060e9:	83 c0 14             	add    $0x14,%eax
c01060ec:	8b 00                	mov    (%eax),%eax
c01060ee:	89 85 7c ff ff ff    	mov    %eax,-0x84(%ebp)
c01060f4:	8b 45 a8             	mov    -0x58(%ebp),%eax
c01060f7:	8b 55 ac             	mov    -0x54(%ebp),%edx
c01060fa:	89 c6                	mov    %eax,%esi
c01060fc:	89 d7                	mov    %edx,%edi
c01060fe:	83 c6 ff             	add    $0xffffffff,%esi
c0106101:	83 d7 ff             	adc    $0xffffffff,%edi
c0106104:	8b 55 98             	mov    -0x68(%ebp),%edx
c0106107:	8b 4d 8c             	mov    -0x74(%ebp),%ecx
c010610a:	89 d0                	mov    %edx,%eax
c010610c:	c1 e0 02             	shl    $0x2,%eax
c010610f:	01 d0                	add    %edx,%eax
c0106111:	c1 e0 02             	shl    $0x2,%eax
c0106114:	8b 5c 08 10          	mov    0x10(%eax,%ecx,1),%ebx
c0106118:	8b 4c 08 0c          	mov    0xc(%eax,%ecx,1),%ecx
c010611c:	8b 85 7c ff ff ff    	mov    -0x84(%ebp),%eax
c0106122:	89 44 24 1c          	mov    %eax,0x1c(%esp)
c0106126:	89 74 24 14          	mov    %esi,0x14(%esp)
c010612a:	89 7c 24 18          	mov    %edi,0x18(%esp)
c010612e:	8b 45 a0             	mov    -0x60(%ebp),%eax
c0106131:	8b 55 a4             	mov    -0x5c(%ebp),%edx
c0106134:	89 44 24 0c          	mov    %eax,0xc(%esp)
c0106138:	89 54 24 10          	mov    %edx,0x10(%esp)
c010613c:	89 4c 24 04          	mov    %ecx,0x4(%esp)
c0106140:	89 5c 24 08          	mov    %ebx,0x8(%esp)
c0106144:	c7 04 24 a0 c1 10 c0 	movl   $0xc010c1a0,(%esp)
c010614b:	e8 7c b4 ff ff       	call   c01015cc <cprintf>
                memmap->map[i].size, begin, end - 1, memmap->map[i].type);
        if (memmap->map[i].type == E820_ARM) {
c0106150:	8b 55 98             	mov    -0x68(%ebp),%edx
c0106153:	8b 4d 8c             	mov    -0x74(%ebp),%ecx
c0106156:	89 d0                	mov    %edx,%eax
c0106158:	c1 e0 02             	shl    $0x2,%eax
c010615b:	01 d0                	add    %edx,%eax
c010615d:	c1 e0 02             	shl    $0x2,%eax
c0106160:	01 c8                	add    %ecx,%eax
c0106162:	83 c0 14             	add    $0x14,%eax
c0106165:	8b 00                	mov    (%eax),%eax
c0106167:	83 f8 01             	cmp    $0x1,%eax
c010616a:	75 36                	jne    c01061a2 <page_init+0x146>
            if (maxpa < end && begin < KMEMSIZE) {
c010616c:	8b 45 90             	mov    -0x70(%ebp),%eax
c010616f:	8b 55 94             	mov    -0x6c(%ebp),%edx
c0106172:	3b 55 ac             	cmp    -0x54(%ebp),%edx
c0106175:	77 2b                	ja     c01061a2 <page_init+0x146>
c0106177:	3b 55 ac             	cmp    -0x54(%ebp),%edx
c010617a:	72 05                	jb     c0106181 <page_init+0x125>
c010617c:	3b 45 a8             	cmp    -0x58(%ebp),%eax
c010617f:	73 21                	jae    c01061a2 <page_init+0x146>
c0106181:	83 7d a4 00          	cmpl   $0x0,-0x5c(%ebp)
c0106185:	77 1b                	ja     c01061a2 <page_init+0x146>
c0106187:	83 7d a4 00          	cmpl   $0x0,-0x5c(%ebp)
c010618b:	72 09                	jb     c0106196 <page_init+0x13a>
c010618d:	81 7d a0 ff ff ff 37 	cmpl   $0x37ffffff,-0x60(%ebp)
c0106194:	77 0c                	ja     c01061a2 <page_init+0x146>
                maxpa = end;
c0106196:	8b 45 a8             	mov    -0x58(%ebp),%eax
c0106199:	8b 55 ac             	mov    -0x54(%ebp),%edx
c010619c:	89 45 90             	mov    %eax,-0x70(%ebp)
c010619f:	89 55 94             	mov    %edx,-0x6c(%ebp)
    struct e820map *memmap = (struct e820map *)(0x8000 + KERNBASE);
    uint64_t maxpa = 0;

    cprintf("e820map:\n");
    int i;
    for (i = 0; i < memmap->nr_map; i ++) {
c01061a2:	83 45 98 01          	addl   $0x1,-0x68(%ebp)
c01061a6:	8b 45 8c             	mov    -0x74(%ebp),%eax
c01061a9:	8b 00                	mov    (%eax),%eax
c01061ab:	3b 45 98             	cmp    -0x68(%ebp),%eax
c01061ae:	0f 8f e1 fe ff ff    	jg     c0106095 <page_init+0x39>
            if (maxpa < end && begin < KMEMSIZE) {
                maxpa = end;
            }
        }
    }
    if (maxpa > KMEMSIZE) {
c01061b4:	83 7d 94 00          	cmpl   $0x0,-0x6c(%ebp)
c01061b8:	72 1d                	jb     c01061d7 <page_init+0x17b>
c01061ba:	83 7d 94 00          	cmpl   $0x0,-0x6c(%ebp)
c01061be:	77 09                	ja     c01061c9 <page_init+0x16d>
c01061c0:	81 7d 90 00 00 00 38 	cmpl   $0x38000000,-0x70(%ebp)
c01061c7:	76 0e                	jbe    c01061d7 <page_init+0x17b>
        maxpa = KMEMSIZE;
c01061c9:	c7 45 90 00 00 00 38 	movl   $0x38000000,-0x70(%ebp)
c01061d0:	c7 45 94 00 00 00 00 	movl   $0x0,-0x6c(%ebp)
    }

    extern char end[];

    npage = maxpa / PGSIZE;
c01061d7:	8b 45 90             	mov    -0x70(%ebp),%eax
c01061da:	8b 55 94             	mov    -0x6c(%ebp),%edx
c01061dd:	0f ac d0 0c          	shrd   $0xc,%edx,%eax
c01061e1:	c1 ea 0c             	shr    $0xc,%edx
c01061e4:	a3 00 8a 12 c0       	mov    %eax,0xc0128a00
    pages = (struct Page *)ROUNDUP((void *)end, PGSIZE);
c01061e9:	c7 45 b4 00 10 00 00 	movl   $0x1000,-0x4c(%ebp)
c01061f0:	b8 bc 8c 12 c0       	mov    $0xc0128cbc,%eax
c01061f5:	83 e8 01             	sub    $0x1,%eax
c01061f8:	03 45 b4             	add    -0x4c(%ebp),%eax
c01061fb:	89 45 b8             	mov    %eax,-0x48(%ebp)
c01061fe:	8b 45 b8             	mov    -0x48(%ebp),%eax
c0106201:	ba 00 00 00 00       	mov    $0x0,%edx
c0106206:	f7 75 b4             	divl   -0x4c(%ebp)
c0106209:	89 d0                	mov    %edx,%eax
c010620b:	8b 55 b8             	mov    -0x48(%ebp),%edx
c010620e:	89 d1                	mov    %edx,%ecx
c0106210:	29 c1                	sub    %eax,%ecx
c0106212:	89 c8                	mov    %ecx,%eax
c0106214:	a3 b4 8c 12 c0       	mov    %eax,0xc0128cb4

    for (i = 0; i < npage; i ++) {
c0106219:	c7 45 98 00 00 00 00 	movl   $0x0,-0x68(%ebp)
c0106220:	eb 2f                	jmp    c0106251 <page_init+0x1f5>
        SetPageReserved(pages + i);
c0106222:	8b 0d b4 8c 12 c0    	mov    0xc0128cb4,%ecx
c0106228:	8b 55 98             	mov    -0x68(%ebp),%edx
c010622b:	89 d0                	mov    %edx,%eax
c010622d:	01 c0                	add    %eax,%eax
c010622f:	01 d0                	add    %edx,%eax
c0106231:	c1 e0 03             	shl    $0x3,%eax
c0106234:	8d 04 01             	lea    (%ecx,%eax,1),%eax
c0106237:	83 c0 04             	add    $0x4,%eax
c010623a:	c7 45 e4 00 00 00 00 	movl   $0x0,-0x1c(%ebp)
c0106241:	89 45 e0             	mov    %eax,-0x20(%ebp)
 * Note that @nr may be almost arbitrarily large; this function is not
 * restricted to acting on a single-word quantity.
 * */
static inline void
set_bit(int nr, volatile void *addr) {
    asm volatile ("btsl %1, %0" :"=m" (*(volatile long *)addr) : "Ir" (nr));
c0106244:	8b 45 e0             	mov    -0x20(%ebp),%eax
c0106247:	8b 55 e4             	mov    -0x1c(%ebp),%edx
c010624a:	0f ab 10             	bts    %edx,(%eax)
    extern char end[];

    npage = maxpa / PGSIZE;
    pages = (struct Page *)ROUNDUP((void *)end, PGSIZE);

    for (i = 0; i < npage; i ++) {
c010624d:	83 45 98 01          	addl   $0x1,-0x68(%ebp)
c0106251:	8b 55 98             	mov    -0x68(%ebp),%edx
c0106254:	a1 00 8a 12 c0       	mov    0xc0128a00,%eax
c0106259:	39 c2                	cmp    %eax,%edx
c010625b:	72 c5                	jb     c0106222 <page_init+0x1c6>
        SetPageReserved(pages + i);
    }

    uintptr_t freemem = PADDR((uintptr_t)pages + sizeof(struct Page) * npage);
c010625d:	8b 15 00 8a 12 c0    	mov    0xc0128a00,%edx
c0106263:	89 d0                	mov    %edx,%eax
c0106265:	01 c0                	add    %eax,%eax
c0106267:	01 d0                	add    %edx,%eax
c0106269:	c1 e0 03             	shl    $0x3,%eax
c010626c:	89 c2                	mov    %eax,%edx
c010626e:	a1 b4 8c 12 c0       	mov    0xc0128cb4,%eax
c0106273:	8d 04 02             	lea    (%edx,%eax,1),%eax
c0106276:	89 45 bc             	mov    %eax,-0x44(%ebp)
c0106279:	81 7d bc ff ff ff bf 	cmpl   $0xbfffffff,-0x44(%ebp)
c0106280:	77 23                	ja     c01062a5 <page_init+0x249>
c0106282:	8b 45 bc             	mov    -0x44(%ebp),%eax
c0106285:	89 44 24 0c          	mov    %eax,0xc(%esp)
c0106289:	c7 44 24 08 d0 c1 10 	movl   $0xc010c1d0,0x8(%esp)
c0106290:	c0 
c0106291:	c7 44 24 04 dc 00 00 	movl   $0xdc,0x4(%esp)
c0106298:	00 
c0106299:	c7 04 24 f4 c1 10 c0 	movl   $0xc010c1f4,(%esp)
c01062a0:	e8 0b c8 ff ff       	call   c0102ab0 <__panic>
c01062a5:	8b 45 bc             	mov    -0x44(%ebp),%eax
c01062a8:	05 00 00 00 40       	add    $0x40000000,%eax
c01062ad:	89 45 9c             	mov    %eax,-0x64(%ebp)

    for (i = 0; i < memmap->nr_map; i ++) {
c01062b0:	c7 45 98 00 00 00 00 	movl   $0x0,-0x68(%ebp)
c01062b7:	e9 71 01 00 00       	jmp    c010642d <page_init+0x3d1>
        uint64_t begin = memmap->map[i].addr, end = begin + memmap->map[i].size;
c01062bc:	8b 55 98             	mov    -0x68(%ebp),%edx
c01062bf:	8b 4d 8c             	mov    -0x74(%ebp),%ecx
c01062c2:	89 d0                	mov    %edx,%eax
c01062c4:	c1 e0 02             	shl    $0x2,%eax
c01062c7:	01 d0                	add    %edx,%eax
c01062c9:	c1 e0 02             	shl    $0x2,%eax
c01062cc:	8b 54 08 08          	mov    0x8(%eax,%ecx,1),%edx
c01062d0:	8b 44 08 04          	mov    0x4(%eax,%ecx,1),%eax
c01062d4:	89 45 c0             	mov    %eax,-0x40(%ebp)
c01062d7:	89 55 c4             	mov    %edx,-0x3c(%ebp)
c01062da:	8b 55 98             	mov    -0x68(%ebp),%edx
c01062dd:	8b 4d 8c             	mov    -0x74(%ebp),%ecx
c01062e0:	89 d0                	mov    %edx,%eax
c01062e2:	c1 e0 02             	shl    $0x2,%eax
c01062e5:	01 d0                	add    %edx,%eax
c01062e7:	c1 e0 02             	shl    $0x2,%eax
c01062ea:	8b 54 08 10          	mov    0x10(%eax,%ecx,1),%edx
c01062ee:	8b 44 08 0c          	mov    0xc(%eax,%ecx,1),%eax
c01062f2:	03 45 c0             	add    -0x40(%ebp),%eax
c01062f5:	13 55 c4             	adc    -0x3c(%ebp),%edx
c01062f8:	89 45 c8             	mov    %eax,-0x38(%ebp)
c01062fb:	89 55 cc             	mov    %edx,-0x34(%ebp)
        if (memmap->map[i].type == E820_ARM) {
c01062fe:	8b 55 98             	mov    -0x68(%ebp),%edx
c0106301:	8b 4d 8c             	mov    -0x74(%ebp),%ecx
c0106304:	89 d0                	mov    %edx,%eax
c0106306:	c1 e0 02             	shl    $0x2,%eax
c0106309:	01 d0                	add    %edx,%eax
c010630b:	c1 e0 02             	shl    $0x2,%eax
c010630e:	01 c8                	add    %ecx,%eax
c0106310:	83 c0 14             	add    $0x14,%eax
c0106313:	8b 00                	mov    (%eax),%eax
c0106315:	83 f8 01             	cmp    $0x1,%eax
c0106318:	0f 85 0b 01 00 00    	jne    c0106429 <page_init+0x3cd>
            if (begin < freemem) {
c010631e:	8b 45 9c             	mov    -0x64(%ebp),%eax
c0106321:	ba 00 00 00 00       	mov    $0x0,%edx
c0106326:	3b 55 c4             	cmp    -0x3c(%ebp),%edx
c0106329:	72 18                	jb     c0106343 <page_init+0x2e7>
c010632b:	3b 55 c4             	cmp    -0x3c(%ebp),%edx
c010632e:	77 05                	ja     c0106335 <page_init+0x2d9>
c0106330:	3b 45 c0             	cmp    -0x40(%ebp),%eax
c0106333:	76 0e                	jbe    c0106343 <page_init+0x2e7>
                begin = freemem;
c0106335:	8b 45 9c             	mov    -0x64(%ebp),%eax
c0106338:	ba 00 00 00 00       	mov    $0x0,%edx
c010633d:	89 45 c0             	mov    %eax,-0x40(%ebp)
c0106340:	89 55 c4             	mov    %edx,-0x3c(%ebp)
            }
            if (end > KMEMSIZE) {
c0106343:	83 7d cc 00          	cmpl   $0x0,-0x34(%ebp)
c0106347:	72 1d                	jb     c0106366 <page_init+0x30a>
c0106349:	83 7d cc 00          	cmpl   $0x0,-0x34(%ebp)
c010634d:	77 09                	ja     c0106358 <page_init+0x2fc>
c010634f:	81 7d c8 00 00 00 38 	cmpl   $0x38000000,-0x38(%ebp)
c0106356:	76 0e                	jbe    c0106366 <page_init+0x30a>
                end = KMEMSIZE;
c0106358:	c7 45 c8 00 00 00 38 	movl   $0x38000000,-0x38(%ebp)
c010635f:	c7 45 cc 00 00 00 00 	movl   $0x0,-0x34(%ebp)
            }
            if (begin < end) {
c0106366:	8b 45 c0             	mov    -0x40(%ebp),%eax
c0106369:	8b 55 c4             	mov    -0x3c(%ebp),%edx
c010636c:	3b 55 cc             	cmp    -0x34(%ebp),%edx
c010636f:	0f 87 b4 00 00 00    	ja     c0106429 <page_init+0x3cd>
c0106375:	3b 55 cc             	cmp    -0x34(%ebp),%edx
c0106378:	72 09                	jb     c0106383 <page_init+0x327>
c010637a:	3b 45 c8             	cmp    -0x38(%ebp),%eax
c010637d:	0f 83 a6 00 00 00    	jae    c0106429 <page_init+0x3cd>
                begin = ROUNDUP(begin, PGSIZE);
c0106383:	c7 45 d4 00 10 00 00 	movl   $0x1000,-0x2c(%ebp)
c010638a:	8b 45 c0             	mov    -0x40(%ebp),%eax
c010638d:	03 45 d4             	add    -0x2c(%ebp),%eax
c0106390:	83 e8 01             	sub    $0x1,%eax
c0106393:	89 45 d8             	mov    %eax,-0x28(%ebp)
c0106396:	8b 45 d8             	mov    -0x28(%ebp),%eax
c0106399:	ba 00 00 00 00       	mov    $0x0,%edx
c010639e:	f7 75 d4             	divl   -0x2c(%ebp)
c01063a1:	89 d0                	mov    %edx,%eax
c01063a3:	8b 55 d8             	mov    -0x28(%ebp),%edx
c01063a6:	89 d1                	mov    %edx,%ecx
c01063a8:	29 c1                	sub    %eax,%ecx
c01063aa:	89 c8                	mov    %ecx,%eax
c01063ac:	ba 00 00 00 00       	mov    $0x0,%edx
c01063b1:	89 45 c0             	mov    %eax,-0x40(%ebp)
c01063b4:	89 55 c4             	mov    %edx,-0x3c(%ebp)
                end = ROUNDDOWN(end, PGSIZE);
c01063b7:	8b 45 c8             	mov    -0x38(%ebp),%eax
c01063ba:	89 45 dc             	mov    %eax,-0x24(%ebp)
c01063bd:	8b 45 dc             	mov    -0x24(%ebp),%eax
c01063c0:	ba 00 00 00 00       	mov    $0x0,%edx
c01063c5:	89 c1                	mov    %eax,%ecx
c01063c7:	81 e1 00 f0 ff ff    	and    $0xfffff000,%ecx
c01063cd:	89 4d 80             	mov    %ecx,-0x80(%ebp)
c01063d0:	89 d1                	mov    %edx,%ecx
c01063d2:	83 e1 00             	and    $0x0,%ecx
c01063d5:	89 4d 84             	mov    %ecx,-0x7c(%ebp)
c01063d8:	8b 45 80             	mov    -0x80(%ebp),%eax
c01063db:	8b 55 84             	mov    -0x7c(%ebp),%edx
c01063de:	89 45 c8             	mov    %eax,-0x38(%ebp)
c01063e1:	89 55 cc             	mov    %edx,-0x34(%ebp)
                if (begin < end) {
c01063e4:	8b 45 c0             	mov    -0x40(%ebp),%eax
c01063e7:	8b 55 c4             	mov    -0x3c(%ebp),%edx
c01063ea:	3b 55 cc             	cmp    -0x34(%ebp),%edx
c01063ed:	77 3a                	ja     c0106429 <page_init+0x3cd>
c01063ef:	3b 55 cc             	cmp    -0x34(%ebp),%edx
c01063f2:	72 05                	jb     c01063f9 <page_init+0x39d>
c01063f4:	3b 45 c8             	cmp    -0x38(%ebp),%eax
c01063f7:	73 30                	jae    c0106429 <page_init+0x3cd>
                    init_memmap(pa2page(begin), (end - begin) / PGSIZE);
c01063f9:	8b 4d c0             	mov    -0x40(%ebp),%ecx
c01063fc:	8b 5d c4             	mov    -0x3c(%ebp),%ebx
c01063ff:	8b 45 c8             	mov    -0x38(%ebp),%eax
c0106402:	8b 55 cc             	mov    -0x34(%ebp),%edx
c0106405:	29 c8                	sub    %ecx,%eax
c0106407:	19 da                	sbb    %ebx,%edx
c0106409:	0f ac d0 0c          	shrd   $0xc,%edx,%eax
c010640d:	c1 ea 0c             	shr    $0xc,%edx
c0106410:	89 c3                	mov    %eax,%ebx
c0106412:	8b 45 c0             	mov    -0x40(%ebp),%eax
c0106415:	89 04 24             	mov    %eax,(%esp)
c0106418:	e8 71 f8 ff ff       	call   c0105c8e <pa2page>
c010641d:	89 5c 24 04          	mov    %ebx,0x4(%esp)
c0106421:	89 04 24             	mov    %eax,(%esp)
c0106424:	e8 86 fb ff ff       	call   c0105faf <init_memmap>
        SetPageReserved(pages + i);
    }

    uintptr_t freemem = PADDR((uintptr_t)pages + sizeof(struct Page) * npage);

    for (i = 0; i < memmap->nr_map; i ++) {
c0106429:	83 45 98 01          	addl   $0x1,-0x68(%ebp)
c010642d:	8b 45 8c             	mov    -0x74(%ebp),%eax
c0106430:	8b 00                	mov    (%eax),%eax
c0106432:	3b 45 98             	cmp    -0x68(%ebp),%eax
c0106435:	0f 8f 81 fe ff ff    	jg     c01062bc <page_init+0x260>
                    init_memmap(pa2page(begin), (end - begin) / PGSIZE);
                }
            }
        }
    }
}
c010643b:	81 c4 9c 00 00 00    	add    $0x9c,%esp
c0106441:	5b                   	pop    %ebx
c0106442:	5e                   	pop    %esi
c0106443:	5f                   	pop    %edi
c0106444:	5d                   	pop    %ebp
c0106445:	c3                   	ret    

c0106446 <enable_paging>:

static void
enable_paging(void) {
c0106446:	55                   	push   %ebp
c0106447:	89 e5                	mov    %esp,%ebp
c0106449:	83 ec 10             	sub    $0x10,%esp
    lcr3(boot_cr3);
c010644c:	a1 b0 8c 12 c0       	mov    0xc0128cb0,%eax
c0106451:	89 45 f4             	mov    %eax,-0xc(%ebp)
    asm volatile ("mov %0, %%cr0" :: "r" (cr0));
}

static inline void
lcr3(uintptr_t cr3) {
    asm volatile ("mov %0, %%cr3" :: "r" (cr3));
c0106454:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0106457:	0f 22 d8             	mov    %eax,%cr3
}

static inline uintptr_t
rcr0(void) {
    uintptr_t cr0;
    asm volatile ("mov %%cr0, %0" : "=r" (cr0));
c010645a:	0f 20 c0             	mov    %cr0,%eax
c010645d:	89 45 f8             	mov    %eax,-0x8(%ebp)
    return cr0;
c0106460:	8b 45 f8             	mov    -0x8(%ebp),%eax

    // turn on paging
    uint32_t cr0 = rcr0();
c0106463:	89 45 f0             	mov    %eax,-0x10(%ebp)
    cr0 |= CR0_PE | CR0_PG | CR0_AM | CR0_WP | CR0_NE | CR0_TS | CR0_EM | CR0_MP;
c0106466:	81 4d f0 2f 00 05 80 	orl    $0x8005002f,-0x10(%ebp)
    cr0 &= ~(CR0_TS | CR0_EM);
c010646d:	83 65 f0 f3          	andl   $0xfffffff3,-0x10(%ebp)
c0106471:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0106474:	89 45 fc             	mov    %eax,-0x4(%ebp)
    asm volatile ("pushl %0; popfl" :: "r" (eflags));
}

static inline void
lcr0(uintptr_t cr0) {
    asm volatile ("mov %0, %%cr0" :: "r" (cr0));
c0106477:	8b 45 fc             	mov    -0x4(%ebp),%eax
c010647a:	0f 22 c0             	mov    %eax,%cr0
    lcr0(cr0);
}
c010647d:	c9                   	leave  
c010647e:	c3                   	ret    

c010647f <boot_map_segment>:
//  la:   linear address of this memory need to map (after x86 segment map)
//  size: memory size
//  pa:   physical address of this memory
//  perm: permission of this memory  
static void
boot_map_segment(pde_t *pgdir, uintptr_t la, size_t size, uintptr_t pa, uint32_t perm) {
c010647f:	55                   	push   %ebp
c0106480:	89 e5                	mov    %esp,%ebp
c0106482:	83 ec 38             	sub    $0x38,%esp
    assert(PGOFF(la) == PGOFF(pa));
c0106485:	8b 45 14             	mov    0x14(%ebp),%eax
c0106488:	8b 55 0c             	mov    0xc(%ebp),%edx
c010648b:	31 d0                	xor    %edx,%eax
c010648d:	25 ff 0f 00 00       	and    $0xfff,%eax
c0106492:	85 c0                	test   %eax,%eax
c0106494:	74 24                	je     c01064ba <boot_map_segment+0x3b>
c0106496:	c7 44 24 0c 02 c2 10 	movl   $0xc010c202,0xc(%esp)
c010649d:	c0 
c010649e:	c7 44 24 08 19 c2 10 	movl   $0xc010c219,0x8(%esp)
c01064a5:	c0 
c01064a6:	c7 44 24 04 05 01 00 	movl   $0x105,0x4(%esp)
c01064ad:	00 
c01064ae:	c7 04 24 f4 c1 10 c0 	movl   $0xc010c1f4,(%esp)
c01064b5:	e8 f6 c5 ff ff       	call   c0102ab0 <__panic>
    size_t n = ROUNDUP(size + PGOFF(la), PGSIZE) / PGSIZE;
c01064ba:	c7 45 e4 00 10 00 00 	movl   $0x1000,-0x1c(%ebp)
c01064c1:	8b 45 0c             	mov    0xc(%ebp),%eax
c01064c4:	25 ff 0f 00 00       	and    $0xfff,%eax
c01064c9:	03 45 10             	add    0x10(%ebp),%eax
c01064cc:	03 45 e4             	add    -0x1c(%ebp),%eax
c01064cf:	83 e8 01             	sub    $0x1,%eax
c01064d2:	89 45 e8             	mov    %eax,-0x18(%ebp)
c01064d5:	8b 45 e8             	mov    -0x18(%ebp),%eax
c01064d8:	ba 00 00 00 00       	mov    $0x0,%edx
c01064dd:	f7 75 e4             	divl   -0x1c(%ebp)
c01064e0:	89 d0                	mov    %edx,%eax
c01064e2:	8b 55 e8             	mov    -0x18(%ebp),%edx
c01064e5:	89 d1                	mov    %edx,%ecx
c01064e7:	29 c1                	sub    %eax,%ecx
c01064e9:	89 c8                	mov    %ecx,%eax
c01064eb:	c1 e8 0c             	shr    $0xc,%eax
c01064ee:	89 45 e0             	mov    %eax,-0x20(%ebp)
    la = ROUNDDOWN(la, PGSIZE);
c01064f1:	8b 45 0c             	mov    0xc(%ebp),%eax
c01064f4:	89 45 ec             	mov    %eax,-0x14(%ebp)
c01064f7:	8b 45 ec             	mov    -0x14(%ebp),%eax
c01064fa:	25 00 f0 ff ff       	and    $0xfffff000,%eax
c01064ff:	89 45 0c             	mov    %eax,0xc(%ebp)
    pa = ROUNDDOWN(pa, PGSIZE);
c0106502:	8b 45 14             	mov    0x14(%ebp),%eax
c0106505:	89 45 f0             	mov    %eax,-0x10(%ebp)
c0106508:	8b 45 f0             	mov    -0x10(%ebp),%eax
c010650b:	25 00 f0 ff ff       	and    $0xfffff000,%eax
c0106510:	89 45 14             	mov    %eax,0x14(%ebp)
    for (; n > 0; n --, la += PGSIZE, pa += PGSIZE) {
c0106513:	eb 6b                	jmp    c0106580 <boot_map_segment+0x101>
        pte_t *ptep = get_pte(pgdir, la, 1);
c0106515:	c7 44 24 08 01 00 00 	movl   $0x1,0x8(%esp)
c010651c:	00 
c010651d:	8b 45 0c             	mov    0xc(%ebp),%eax
c0106520:	89 44 24 04          	mov    %eax,0x4(%esp)
c0106524:	8b 45 08             	mov    0x8(%ebp),%eax
c0106527:	89 04 24             	mov    %eax,(%esp)
c010652a:	e8 d3 01 00 00       	call   c0106702 <get_pte>
c010652f:	89 45 f4             	mov    %eax,-0xc(%ebp)
        assert(ptep != NULL);
c0106532:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c0106536:	75 24                	jne    c010655c <boot_map_segment+0xdd>
c0106538:	c7 44 24 0c 2e c2 10 	movl   $0xc010c22e,0xc(%esp)
c010653f:	c0 
c0106540:	c7 44 24 08 19 c2 10 	movl   $0xc010c219,0x8(%esp)
c0106547:	c0 
c0106548:	c7 44 24 04 0b 01 00 	movl   $0x10b,0x4(%esp)
c010654f:	00 
c0106550:	c7 04 24 f4 c1 10 c0 	movl   $0xc010c1f4,(%esp)
c0106557:	e8 54 c5 ff ff       	call   c0102ab0 <__panic>
        *ptep = pa | PTE_P | perm;
c010655c:	8b 45 18             	mov    0x18(%ebp),%eax
c010655f:	8b 55 14             	mov    0x14(%ebp),%edx
c0106562:	09 d0                	or     %edx,%eax
c0106564:	89 c2                	mov    %eax,%edx
c0106566:	83 ca 01             	or     $0x1,%edx
c0106569:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010656c:	89 10                	mov    %edx,(%eax)
boot_map_segment(pde_t *pgdir, uintptr_t la, size_t size, uintptr_t pa, uint32_t perm) {
    assert(PGOFF(la) == PGOFF(pa));
    size_t n = ROUNDUP(size + PGOFF(la), PGSIZE) / PGSIZE;
    la = ROUNDDOWN(la, PGSIZE);
    pa = ROUNDDOWN(pa, PGSIZE);
    for (; n > 0; n --, la += PGSIZE, pa += PGSIZE) {
c010656e:	83 6d e0 01          	subl   $0x1,-0x20(%ebp)
c0106572:	81 45 0c 00 10 00 00 	addl   $0x1000,0xc(%ebp)
c0106579:	81 45 14 00 10 00 00 	addl   $0x1000,0x14(%ebp)
c0106580:	83 7d e0 00          	cmpl   $0x0,-0x20(%ebp)
c0106584:	75 8f                	jne    c0106515 <boot_map_segment+0x96>
        pte_t *ptep = get_pte(pgdir, la, 1);
        assert(ptep != NULL);
        *ptep = pa | PTE_P | perm;
    }
}
c0106586:	c9                   	leave  
c0106587:	c3                   	ret    

c0106588 <boot_alloc_page>:

//boot_alloc_page - allocate one page using pmm->alloc_pages(1) 
// return value: the kernel virtual address of this allocated page
//note: this function is used to get the memory for PDT(Page Directory Table)&PT(Page Table)
static void *
boot_alloc_page(void) {
c0106588:	55                   	push   %ebp
c0106589:	89 e5                	mov    %esp,%ebp
c010658b:	83 ec 28             	sub    $0x28,%esp
    struct Page *p = alloc_page();
c010658e:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
c0106595:	e8 34 fa ff ff       	call   c0105fce <alloc_pages>
c010659a:	89 45 f4             	mov    %eax,-0xc(%ebp)
    if (p == NULL) {
c010659d:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c01065a1:	75 1c                	jne    c01065bf <boot_alloc_page+0x37>
        panic("boot_alloc_page failed.\n");
c01065a3:	c7 44 24 08 3b c2 10 	movl   $0xc010c23b,0x8(%esp)
c01065aa:	c0 
c01065ab:	c7 44 24 04 17 01 00 	movl   $0x117,0x4(%esp)
c01065b2:	00 
c01065b3:	c7 04 24 f4 c1 10 c0 	movl   $0xc010c1f4,(%esp)
c01065ba:	e8 f1 c4 ff ff       	call   c0102ab0 <__panic>
    }
    return page2kva(p);
c01065bf:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01065c2:	89 04 24             	mov    %eax,(%esp)
c01065c5:	e8 13 f7 ff ff       	call   c0105cdd <page2kva>
}
c01065ca:	c9                   	leave  
c01065cb:	c3                   	ret    

c01065cc <pmm_init>:

//pmm_init - setup a pmm to manage physical memory, build PDT&PT to setup paging mechanism 
//         - check the correctness of pmm & paging mechanism, print PDT&PT
void
pmm_init(void) {
c01065cc:	55                   	push   %ebp
c01065cd:	89 e5                	mov    %esp,%ebp
c01065cf:	83 ec 38             	sub    $0x38,%esp
    //We need to alloc/free the physical memory (granularity is 4KB or other size). 
    //So a framework of physical memory manager (struct pmm_manager)is defined in pmm.h
    //First we should init a physical memory manager(pmm) based on the framework.
    //Then pmm can alloc/free the physical memory. 
    //Now the first_fit/best_fit/worst_fit/buddy_system pmm are available.
    init_pmm_manager();
c01065d2:	e8 a5 f9 ff ff       	call   c0105f7c <init_pmm_manager>

    // detect physical memory space, reserve already used memory,
    // then use pmm->init_memmap to create free page list
    page_init();
c01065d7:	e8 80 fa ff ff       	call   c010605c <page_init>

    //use pmm->check to verify the correctness of the alloc/free function in a pmm
    check_alloc_page();
c01065dc:	e8 c5 04 00 00       	call   c0106aa6 <check_alloc_page>

    // create boot_pgdir, an initial page directory(Page Directory Table, PDT)
    boot_pgdir = boot_alloc_page();
c01065e1:	e8 a2 ff ff ff       	call   c0106588 <boot_alloc_page>
c01065e6:	a3 04 8a 12 c0       	mov    %eax,0xc0128a04
    memset(boot_pgdir, 0, PGSIZE);
c01065eb:	a1 04 8a 12 c0       	mov    0xc0128a04,%eax
c01065f0:	c7 44 24 08 00 10 00 	movl   $0x1000,0x8(%esp)
c01065f7:	00 
c01065f8:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
c01065ff:	00 
c0106600:	89 04 24             	mov    %eax,(%esp)
c0106603:	e8 3b 46 00 00       	call   c010ac43 <memset>
    boot_cr3 = PADDR(boot_pgdir);
c0106608:	a1 04 8a 12 c0       	mov    0xc0128a04,%eax
c010660d:	89 45 f0             	mov    %eax,-0x10(%ebp)
c0106610:	81 7d f0 ff ff ff bf 	cmpl   $0xbfffffff,-0x10(%ebp)
c0106617:	77 23                	ja     c010663c <pmm_init+0x70>
c0106619:	8b 45 f0             	mov    -0x10(%ebp),%eax
c010661c:	89 44 24 0c          	mov    %eax,0xc(%esp)
c0106620:	c7 44 24 08 d0 c1 10 	movl   $0xc010c1d0,0x8(%esp)
c0106627:	c0 
c0106628:	c7 44 24 04 31 01 00 	movl   $0x131,0x4(%esp)
c010662f:	00 
c0106630:	c7 04 24 f4 c1 10 c0 	movl   $0xc010c1f4,(%esp)
c0106637:	e8 74 c4 ff ff       	call   c0102ab0 <__panic>
c010663c:	8b 45 f0             	mov    -0x10(%ebp),%eax
c010663f:	05 00 00 00 40       	add    $0x40000000,%eax
c0106644:	a3 b0 8c 12 c0       	mov    %eax,0xc0128cb0

    check_pgdir();
c0106649:	e8 76 04 00 00       	call   c0106ac4 <check_pgdir>

    static_assert(KERNBASE % PTSIZE == 0 && KERNTOP % PTSIZE == 0);

    // recursively insert boot_pgdir in itself
    // to form a virtual page table at virtual address VPT
    boot_pgdir[PDX(VPT)] = PADDR(boot_pgdir) | PTE_P | PTE_W;
c010664e:	a1 04 8a 12 c0       	mov    0xc0128a04,%eax
c0106653:	8d 90 ac 0f 00 00    	lea    0xfac(%eax),%edx
c0106659:	a1 04 8a 12 c0       	mov    0xc0128a04,%eax
c010665e:	89 45 f4             	mov    %eax,-0xc(%ebp)
c0106661:	81 7d f4 ff ff ff bf 	cmpl   $0xbfffffff,-0xc(%ebp)
c0106668:	77 23                	ja     c010668d <pmm_init+0xc1>
c010666a:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010666d:	89 44 24 0c          	mov    %eax,0xc(%esp)
c0106671:	c7 44 24 08 d0 c1 10 	movl   $0xc010c1d0,0x8(%esp)
c0106678:	c0 
c0106679:	c7 44 24 04 39 01 00 	movl   $0x139,0x4(%esp)
c0106680:	00 
c0106681:	c7 04 24 f4 c1 10 c0 	movl   $0xc010c1f4,(%esp)
c0106688:	e8 23 c4 ff ff       	call   c0102ab0 <__panic>
c010668d:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0106690:	05 00 00 00 40       	add    $0x40000000,%eax
c0106695:	83 c8 03             	or     $0x3,%eax
c0106698:	89 02                	mov    %eax,(%edx)

    // map all physical memory to linear memory with base linear addr KERNBASE
    //linear_addr KERNBASE~KERNBASE+KMEMSIZE = phy_addr 0~KMEMSIZE
    //But shouldn't use this map until enable_paging() & gdt_init() finished.
    boot_map_segment(boot_pgdir, KERNBASE, KMEMSIZE, 0, PTE_W);
c010669a:	a1 04 8a 12 c0       	mov    0xc0128a04,%eax
c010669f:	c7 44 24 10 02 00 00 	movl   $0x2,0x10(%esp)
c01066a6:	00 
c01066a7:	c7 44 24 0c 00 00 00 	movl   $0x0,0xc(%esp)
c01066ae:	00 
c01066af:	c7 44 24 08 00 00 00 	movl   $0x38000000,0x8(%esp)
c01066b6:	38 
c01066b7:	c7 44 24 04 00 00 00 	movl   $0xc0000000,0x4(%esp)
c01066be:	c0 
c01066bf:	89 04 24             	mov    %eax,(%esp)
c01066c2:	e8 b8 fd ff ff       	call   c010647f <boot_map_segment>

    //temporary map: 
    //virtual_addr 3G~3G+4M = linear_addr 0~4M = linear_addr 3G~3G+4M = phy_addr 0~4M 	
    boot_pgdir[0] = boot_pgdir[PDX(KERNBASE)];
c01066c7:	a1 04 8a 12 c0       	mov    0xc0128a04,%eax
c01066cc:	8b 15 04 8a 12 c0    	mov    0xc0128a04,%edx
c01066d2:	81 c2 00 0c 00 00    	add    $0xc00,%edx
c01066d8:	8b 12                	mov    (%edx),%edx
c01066da:	89 10                	mov    %edx,(%eax)

    enable_paging();
c01066dc:	e8 65 fd ff ff       	call   c0106446 <enable_paging>

    //reload gdt(third time,the last time) to map all physical memory
    //virtual_addr 0~4G=liear_addr 0~4G
    //then set kernel stack(ss:esp) in TSS, setup TSS in gdt, load TSS
    gdt_init();
c01066e1:	e8 a7 f7 ff ff       	call   c0105e8d <gdt_init>

    //disable the map of virtual_addr 0~4M
    boot_pgdir[0] = 0;
c01066e6:	a1 04 8a 12 c0       	mov    0xc0128a04,%eax
c01066eb:	c7 00 00 00 00 00    	movl   $0x0,(%eax)

    //now the basic virtual memory map(see memalyout.h) is established.
    //check the correctness of the basic virtual memory map.
    check_boot_pgdir();
c01066f1:	e8 69 0a 00 00       	call   c010715f <check_boot_pgdir>

    print_pgdir();
c01066f6:	e8 e2 0e 00 00       	call   c01075dd <print_pgdir>

    slab_init();
c01066fb:	e8 bc 11 00 00       	call   c01078bc <slab_init>
}
c0106700:	c9                   	leave  
c0106701:	c3                   	ret    

c0106702 <get_pte>:
//  pgdir:  the kernel virtual base address of PDT
//  la:     the linear address need to map
//  create: a logical value to decide if alloc a page for PT
// return vaule: the kernel virtual address of this pte
pte_t *
get_pte(pde_t *pgdir, uintptr_t la, bool create) {
c0106702:	55                   	push   %ebp
c0106703:	89 e5                	mov    %esp,%ebp
c0106705:	83 ec 38             	sub    $0x38,%esp
    pde_t *pdep = &pgdir[PDX(la)];
c0106708:	8b 45 0c             	mov    0xc(%ebp),%eax
c010670b:	c1 e8 16             	shr    $0x16,%eax
c010670e:	c1 e0 02             	shl    $0x2,%eax
c0106711:	03 45 08             	add    0x8(%ebp),%eax
c0106714:	89 45 dc             	mov    %eax,-0x24(%ebp)
    if (!(*pdep & PTE_P)) {
c0106717:	8b 45 dc             	mov    -0x24(%ebp),%eax
c010671a:	8b 00                	mov    (%eax),%eax
c010671c:	83 e0 01             	and    $0x1,%eax
c010671f:	85 c0                	test   %eax,%eax
c0106721:	0f 85 af 00 00 00    	jne    c01067d6 <get_pte+0xd4>
        struct Page *page;
        if (!create || (page = alloc_page()) == NULL) {
c0106727:	83 7d 10 00          	cmpl   $0x0,0x10(%ebp)
c010672b:	74 15                	je     c0106742 <get_pte+0x40>
c010672d:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
c0106734:	e8 95 f8 ff ff       	call   c0105fce <alloc_pages>
c0106739:	89 45 e0             	mov    %eax,-0x20(%ebp)
c010673c:	83 7d e0 00          	cmpl   $0x0,-0x20(%ebp)
c0106740:	75 0a                	jne    c010674c <get_pte+0x4a>
            return NULL;
c0106742:	b8 00 00 00 00       	mov    $0x0,%eax
c0106747:	e9 e6 00 00 00       	jmp    c0106832 <get_pte+0x130>
        }
        set_page_ref(page, 1);
c010674c:	c7 44 24 04 01 00 00 	movl   $0x1,0x4(%esp)
c0106753:	00 
c0106754:	8b 45 e0             	mov    -0x20(%ebp),%eax
c0106757:	89 04 24             	mov    %eax,(%esp)
c010675a:	e8 23 f6 ff ff       	call   c0105d82 <set_page_ref>
        uintptr_t pa = page2pa(page);
c010675f:	8b 45 e0             	mov    -0x20(%ebp),%eax
c0106762:	89 04 24             	mov    %eax,(%esp)
c0106765:	e8 0e f5 ff ff       	call   c0105c78 <page2pa>
c010676a:	89 45 e4             	mov    %eax,-0x1c(%ebp)
        memset(KADDR(pa), 0, PGSIZE);
c010676d:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0106770:	89 45 e8             	mov    %eax,-0x18(%ebp)
c0106773:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0106776:	c1 e8 0c             	shr    $0xc,%eax
c0106779:	89 45 ec             	mov    %eax,-0x14(%ebp)
c010677c:	a1 00 8a 12 c0       	mov    0xc0128a00,%eax
c0106781:	39 45 ec             	cmp    %eax,-0x14(%ebp)
c0106784:	72 23                	jb     c01067a9 <get_pte+0xa7>
c0106786:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0106789:	89 44 24 0c          	mov    %eax,0xc(%esp)
c010678d:	c7 44 24 08 30 c1 10 	movl   $0xc010c130,0x8(%esp)
c0106794:	c0 
c0106795:	c7 44 24 04 68 01 00 	movl   $0x168,0x4(%esp)
c010679c:	00 
c010679d:	c7 04 24 f4 c1 10 c0 	movl   $0xc010c1f4,(%esp)
c01067a4:	e8 07 c3 ff ff       	call   c0102ab0 <__panic>
c01067a9:	8b 45 e8             	mov    -0x18(%ebp),%eax
c01067ac:	2d 00 00 00 40       	sub    $0x40000000,%eax
c01067b1:	c7 44 24 08 00 10 00 	movl   $0x1000,0x8(%esp)
c01067b8:	00 
c01067b9:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
c01067c0:	00 
c01067c1:	89 04 24             	mov    %eax,(%esp)
c01067c4:	e8 7a 44 00 00       	call   c010ac43 <memset>
        *pdep = pa | PTE_U | PTE_W | PTE_P;
c01067c9:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c01067cc:	89 c2                	mov    %eax,%edx
c01067ce:	83 ca 07             	or     $0x7,%edx
c01067d1:	8b 45 dc             	mov    -0x24(%ebp),%eax
c01067d4:	89 10                	mov    %edx,(%eax)
    }
    return &((pte_t *)KADDR(PDE_ADDR(*pdep)))[PTX(la)];
c01067d6:	8b 45 dc             	mov    -0x24(%ebp),%eax
c01067d9:	8b 00                	mov    (%eax),%eax
c01067db:	25 00 f0 ff ff       	and    $0xfffff000,%eax
c01067e0:	89 45 f0             	mov    %eax,-0x10(%ebp)
c01067e3:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01067e6:	c1 e8 0c             	shr    $0xc,%eax
c01067e9:	89 45 f4             	mov    %eax,-0xc(%ebp)
c01067ec:	a1 00 8a 12 c0       	mov    0xc0128a00,%eax
c01067f1:	39 45 f4             	cmp    %eax,-0xc(%ebp)
c01067f4:	72 23                	jb     c0106819 <get_pte+0x117>
c01067f6:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01067f9:	89 44 24 0c          	mov    %eax,0xc(%esp)
c01067fd:	c7 44 24 08 30 c1 10 	movl   $0xc010c130,0x8(%esp)
c0106804:	c0 
c0106805:	c7 44 24 04 6b 01 00 	movl   $0x16b,0x4(%esp)
c010680c:	00 
c010680d:	c7 04 24 f4 c1 10 c0 	movl   $0xc010c1f4,(%esp)
c0106814:	e8 97 c2 ff ff       	call   c0102ab0 <__panic>
c0106819:	8b 45 f0             	mov    -0x10(%ebp),%eax
c010681c:	2d 00 00 00 40       	sub    $0x40000000,%eax
c0106821:	8b 55 0c             	mov    0xc(%ebp),%edx
c0106824:	c1 ea 0c             	shr    $0xc,%edx
c0106827:	81 e2 ff 03 00 00    	and    $0x3ff,%edx
c010682d:	c1 e2 02             	shl    $0x2,%edx
c0106830:	01 d0                	add    %edx,%eax
}
c0106832:	c9                   	leave  
c0106833:	c3                   	ret    

c0106834 <get_page>:

//get_page - get related Page struct for linear address la using PDT pgdir
struct Page *
get_page(pde_t *pgdir, uintptr_t la, pte_t **ptep_store) {
c0106834:	55                   	push   %ebp
c0106835:	89 e5                	mov    %esp,%ebp
c0106837:	83 ec 28             	sub    $0x28,%esp
    pte_t *ptep = get_pte(pgdir, la, 0);
c010683a:	c7 44 24 08 00 00 00 	movl   $0x0,0x8(%esp)
c0106841:	00 
c0106842:	8b 45 0c             	mov    0xc(%ebp),%eax
c0106845:	89 44 24 04          	mov    %eax,0x4(%esp)
c0106849:	8b 45 08             	mov    0x8(%ebp),%eax
c010684c:	89 04 24             	mov    %eax,(%esp)
c010684f:	e8 ae fe ff ff       	call   c0106702 <get_pte>
c0106854:	89 45 f4             	mov    %eax,-0xc(%ebp)
    if (ptep_store != NULL) {
c0106857:	83 7d 10 00          	cmpl   $0x0,0x10(%ebp)
c010685b:	74 08                	je     c0106865 <get_page+0x31>
        *ptep_store = ptep;
c010685d:	8b 45 10             	mov    0x10(%ebp),%eax
c0106860:	8b 55 f4             	mov    -0xc(%ebp),%edx
c0106863:	89 10                	mov    %edx,(%eax)
    }
    if (ptep != NULL && *ptep & PTE_P) {
c0106865:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c0106869:	74 1b                	je     c0106886 <get_page+0x52>
c010686b:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010686e:	8b 00                	mov    (%eax),%eax
c0106870:	83 e0 01             	and    $0x1,%eax
c0106873:	84 c0                	test   %al,%al
c0106875:	74 0f                	je     c0106886 <get_page+0x52>
        return pa2page(*ptep);
c0106877:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010687a:	8b 00                	mov    (%eax),%eax
c010687c:	89 04 24             	mov    %eax,(%esp)
c010687f:	e8 0a f4 ff ff       	call   c0105c8e <pa2page>
c0106884:	eb 05                	jmp    c010688b <get_page+0x57>
    }
    return NULL;
c0106886:	b8 00 00 00 00       	mov    $0x0,%eax
}
c010688b:	c9                   	leave  
c010688c:	c3                   	ret    

c010688d <page_remove_pte>:

//page_remove_pte - free an Page sturct which is related linear address la
//                - and clean(invalidate) pte which is related linear address la
//note: PT is changed, so the TLB need to be invalidate 
static inline void
page_remove_pte(pde_t *pgdir, uintptr_t la, pte_t *ptep) {
c010688d:	55                   	push   %ebp
c010688e:	89 e5                	mov    %esp,%ebp
c0106890:	83 ec 28             	sub    $0x28,%esp
    if (*ptep & PTE_P) {
c0106893:	8b 45 10             	mov    0x10(%ebp),%eax
c0106896:	8b 00                	mov    (%eax),%eax
c0106898:	83 e0 01             	and    $0x1,%eax
c010689b:	84 c0                	test   %al,%al
c010689d:	74 4d                	je     c01068ec <page_remove_pte+0x5f>
        struct Page *page = pte2page(*ptep);
c010689f:	8b 45 10             	mov    0x10(%ebp),%eax
c01068a2:	8b 00                	mov    (%eax),%eax
c01068a4:	89 04 24             	mov    %eax,(%esp)
c01068a7:	e8 85 f4 ff ff       	call   c0105d31 <pte2page>
c01068ac:	89 45 f4             	mov    %eax,-0xc(%ebp)
        if (page_ref_dec(page) == 0) {
c01068af:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01068b2:	89 04 24             	mov    %eax,(%esp)
c01068b5:	e8 14 f5 ff ff       	call   c0105dce <page_ref_dec>
c01068ba:	85 c0                	test   %eax,%eax
c01068bc:	75 13                	jne    c01068d1 <page_remove_pte+0x44>
            free_page(page);
c01068be:	c7 44 24 04 01 00 00 	movl   $0x1,0x4(%esp)
c01068c5:	00 
c01068c6:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01068c9:	89 04 24             	mov    %eax,(%esp)
c01068cc:	e8 2e f7 ff ff       	call   c0105fff <free_pages>
        }
        *ptep = 0;
c01068d1:	8b 45 10             	mov    0x10(%ebp),%eax
c01068d4:	c7 00 00 00 00 00    	movl   $0x0,(%eax)
        tlb_invalidate(pgdir, la);
c01068da:	8b 45 0c             	mov    0xc(%ebp),%eax
c01068dd:	89 44 24 04          	mov    %eax,0x4(%esp)
c01068e1:	8b 45 08             	mov    0x8(%ebp),%eax
c01068e4:	89 04 24             	mov    %eax,(%esp)
c01068e7:	e8 ff 00 00 00       	call   c01069eb <tlb_invalidate>
    }
}
c01068ec:	c9                   	leave  
c01068ed:	c3                   	ret    

c01068ee <page_remove>:

//page_remove - free an Page which is related linear address la and has an validated pte
void
page_remove(pde_t *pgdir, uintptr_t la) {
c01068ee:	55                   	push   %ebp
c01068ef:	89 e5                	mov    %esp,%ebp
c01068f1:	83 ec 28             	sub    $0x28,%esp
    pte_t *ptep = get_pte(pgdir, la, 0);
c01068f4:	c7 44 24 08 00 00 00 	movl   $0x0,0x8(%esp)
c01068fb:	00 
c01068fc:	8b 45 0c             	mov    0xc(%ebp),%eax
c01068ff:	89 44 24 04          	mov    %eax,0x4(%esp)
c0106903:	8b 45 08             	mov    0x8(%ebp),%eax
c0106906:	89 04 24             	mov    %eax,(%esp)
c0106909:	e8 f4 fd ff ff       	call   c0106702 <get_pte>
c010690e:	89 45 f4             	mov    %eax,-0xc(%ebp)
    if (ptep != NULL) {
c0106911:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c0106915:	74 19                	je     c0106930 <page_remove+0x42>
        page_remove_pte(pgdir, la, ptep);
c0106917:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010691a:	89 44 24 08          	mov    %eax,0x8(%esp)
c010691e:	8b 45 0c             	mov    0xc(%ebp),%eax
c0106921:	89 44 24 04          	mov    %eax,0x4(%esp)
c0106925:	8b 45 08             	mov    0x8(%ebp),%eax
c0106928:	89 04 24             	mov    %eax,(%esp)
c010692b:	e8 5d ff ff ff       	call   c010688d <page_remove_pte>
    }
}
c0106930:	c9                   	leave  
c0106931:	c3                   	ret    

c0106932 <page_insert>:
//  la:    the linear address need to map
//  perm:  the permission of this Page which is setted in related pte
// return value: always 0
//note: PT is changed, so the TLB need to be invalidate 
int
page_insert(pde_t *pgdir, struct Page *page, uintptr_t la, uint32_t perm) {
c0106932:	55                   	push   %ebp
c0106933:	89 e5                	mov    %esp,%ebp
c0106935:	83 ec 28             	sub    $0x28,%esp
    pte_t *ptep = get_pte(pgdir, la, 1);
c0106938:	c7 44 24 08 01 00 00 	movl   $0x1,0x8(%esp)
c010693f:	00 
c0106940:	8b 45 10             	mov    0x10(%ebp),%eax
c0106943:	89 44 24 04          	mov    %eax,0x4(%esp)
c0106947:	8b 45 08             	mov    0x8(%ebp),%eax
c010694a:	89 04 24             	mov    %eax,(%esp)
c010694d:	e8 b0 fd ff ff       	call   c0106702 <get_pte>
c0106952:	89 45 f0             	mov    %eax,-0x10(%ebp)
    if (ptep == NULL) {
c0106955:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
c0106959:	75 0a                	jne    c0106965 <page_insert+0x33>
        return -E_NO_MEM;
c010695b:	b8 fc ff ff ff       	mov    $0xfffffffc,%eax
c0106960:	e9 84 00 00 00       	jmp    c01069e9 <page_insert+0xb7>
    }
    page_ref_inc(page);
c0106965:	8b 45 0c             	mov    0xc(%ebp),%eax
c0106968:	89 04 24             	mov    %eax,(%esp)
c010696b:	e8 2e f4 ff ff       	call   c0105d9e <page_ref_inc>
    if (*ptep & PTE_P) {
c0106970:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0106973:	8b 00                	mov    (%eax),%eax
c0106975:	83 e0 01             	and    $0x1,%eax
c0106978:	84 c0                	test   %al,%al
c010697a:	74 3e                	je     c01069ba <page_insert+0x88>
        struct Page *p = pte2page(*ptep);
c010697c:	8b 45 f0             	mov    -0x10(%ebp),%eax
c010697f:	8b 00                	mov    (%eax),%eax
c0106981:	89 04 24             	mov    %eax,(%esp)
c0106984:	e8 a8 f3 ff ff       	call   c0105d31 <pte2page>
c0106989:	89 45 f4             	mov    %eax,-0xc(%ebp)
        if (p == page) {
c010698c:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010698f:	3b 45 0c             	cmp    0xc(%ebp),%eax
c0106992:	75 0d                	jne    c01069a1 <page_insert+0x6f>
            page_ref_dec(page);
c0106994:	8b 45 0c             	mov    0xc(%ebp),%eax
c0106997:	89 04 24             	mov    %eax,(%esp)
c010699a:	e8 2f f4 ff ff       	call   c0105dce <page_ref_dec>
c010699f:	eb 19                	jmp    c01069ba <page_insert+0x88>
        }
        else {
            page_remove_pte(pgdir, la, ptep);
c01069a1:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01069a4:	89 44 24 08          	mov    %eax,0x8(%esp)
c01069a8:	8b 45 10             	mov    0x10(%ebp),%eax
c01069ab:	89 44 24 04          	mov    %eax,0x4(%esp)
c01069af:	8b 45 08             	mov    0x8(%ebp),%eax
c01069b2:	89 04 24             	mov    %eax,(%esp)
c01069b5:	e8 d3 fe ff ff       	call   c010688d <page_remove_pte>
        }
    }
    *ptep = page2pa(page) | PTE_P | perm;
c01069ba:	8b 45 0c             	mov    0xc(%ebp),%eax
c01069bd:	89 04 24             	mov    %eax,(%esp)
c01069c0:	e8 b3 f2 ff ff       	call   c0105c78 <page2pa>
c01069c5:	0b 45 14             	or     0x14(%ebp),%eax
c01069c8:	89 c2                	mov    %eax,%edx
c01069ca:	83 ca 01             	or     $0x1,%edx
c01069cd:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01069d0:	89 10                	mov    %edx,(%eax)
    tlb_invalidate(pgdir, la);
c01069d2:	8b 45 10             	mov    0x10(%ebp),%eax
c01069d5:	89 44 24 04          	mov    %eax,0x4(%esp)
c01069d9:	8b 45 08             	mov    0x8(%ebp),%eax
c01069dc:	89 04 24             	mov    %eax,(%esp)
c01069df:	e8 07 00 00 00       	call   c01069eb <tlb_invalidate>
    return 0;
c01069e4:	b8 00 00 00 00       	mov    $0x0,%eax
}
c01069e9:	c9                   	leave  
c01069ea:	c3                   	ret    

c01069eb <tlb_invalidate>:

// invalidate a TLB entry, but only if the page tables being
// edited are the ones currently in use by the processor.
void
tlb_invalidate(pde_t *pgdir, uintptr_t la) {
c01069eb:	55                   	push   %ebp
c01069ec:	89 e5                	mov    %esp,%ebp
c01069ee:	83 ec 28             	sub    $0x28,%esp
}

static inline uintptr_t
rcr3(void) {
    uintptr_t cr3;
    asm volatile ("mov %%cr3, %0" : "=r" (cr3));
c01069f1:	0f 20 d8             	mov    %cr3,%eax
c01069f4:	89 45 f0             	mov    %eax,-0x10(%ebp)
    return cr3;
c01069f7:	8b 45 f0             	mov    -0x10(%ebp),%eax
    if (rcr3() == PADDR(pgdir)) {
c01069fa:	89 c2                	mov    %eax,%edx
c01069fc:	8b 45 08             	mov    0x8(%ebp),%eax
c01069ff:	89 45 ec             	mov    %eax,-0x14(%ebp)
c0106a02:	81 7d ec ff ff ff bf 	cmpl   $0xbfffffff,-0x14(%ebp)
c0106a09:	77 23                	ja     c0106a2e <tlb_invalidate+0x43>
c0106a0b:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0106a0e:	89 44 24 0c          	mov    %eax,0xc(%esp)
c0106a12:	c7 44 24 08 d0 c1 10 	movl   $0xc010c1d0,0x8(%esp)
c0106a19:	c0 
c0106a1a:	c7 44 24 04 b4 01 00 	movl   $0x1b4,0x4(%esp)
c0106a21:	00 
c0106a22:	c7 04 24 f4 c1 10 c0 	movl   $0xc010c1f4,(%esp)
c0106a29:	e8 82 c0 ff ff       	call   c0102ab0 <__panic>
c0106a2e:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0106a31:	05 00 00 00 40       	add    $0x40000000,%eax
c0106a36:	39 c2                	cmp    %eax,%edx
c0106a38:	75 0c                	jne    c0106a46 <tlb_invalidate+0x5b>
        invlpg((void *)la);
c0106a3a:	8b 45 0c             	mov    0xc(%ebp),%eax
c0106a3d:	89 45 f4             	mov    %eax,-0xc(%ebp)
}

static inline void
invlpg(void *addr) {
    asm volatile ("invlpg (%0)" :: "r" (addr) : "memory");
c0106a40:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0106a43:	0f 01 38             	invlpg (%eax)
    }
}
c0106a46:	c9                   	leave  
c0106a47:	c3                   	ret    

c0106a48 <pgdir_alloc_page>:

// pgdir_alloc_page - call alloc_page & page_insert functions to 
//                  - allocate a page size memory & setup an addr map
//                  - pa<->la with linear address la and the PDT pgdir
struct Page *
pgdir_alloc_page(pde_t *pgdir, uintptr_t la, uint32_t perm) {
c0106a48:	55                   	push   %ebp
c0106a49:	89 e5                	mov    %esp,%ebp
c0106a4b:	83 ec 28             	sub    $0x28,%esp
    struct Page *page = alloc_page();
c0106a4e:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
c0106a55:	e8 74 f5 ff ff       	call   c0105fce <alloc_pages>
c0106a5a:	89 45 f4             	mov    %eax,-0xc(%ebp)
    if (page != NULL) {
c0106a5d:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c0106a61:	74 3e                	je     c0106aa1 <pgdir_alloc_page+0x59>
        if (page_insert(pgdir, page, la, perm) != 0) {
c0106a63:	8b 45 10             	mov    0x10(%ebp),%eax
c0106a66:	89 44 24 0c          	mov    %eax,0xc(%esp)
c0106a6a:	8b 45 0c             	mov    0xc(%ebp),%eax
c0106a6d:	89 44 24 08          	mov    %eax,0x8(%esp)
c0106a71:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0106a74:	89 44 24 04          	mov    %eax,0x4(%esp)
c0106a78:	8b 45 08             	mov    0x8(%ebp),%eax
c0106a7b:	89 04 24             	mov    %eax,(%esp)
c0106a7e:	e8 af fe ff ff       	call   c0106932 <page_insert>
c0106a83:	85 c0                	test   %eax,%eax
c0106a85:	74 1a                	je     c0106aa1 <pgdir_alloc_page+0x59>
            free_page(page);
c0106a87:	c7 44 24 04 01 00 00 	movl   $0x1,0x4(%esp)
c0106a8e:	00 
c0106a8f:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0106a92:	89 04 24             	mov    %eax,(%esp)
c0106a95:	e8 65 f5 ff ff       	call   c0105fff <free_pages>
            return NULL;
c0106a9a:	b8 00 00 00 00       	mov    $0x0,%eax
c0106a9f:	eb 03                	jmp    c0106aa4 <pgdir_alloc_page+0x5c>
        }
    }
    return page;
c0106aa1:	8b 45 f4             	mov    -0xc(%ebp),%eax
}
c0106aa4:	c9                   	leave  
c0106aa5:	c3                   	ret    

c0106aa6 <check_alloc_page>:

static void
check_alloc_page(void) {
c0106aa6:	55                   	push   %ebp
c0106aa7:	89 e5                	mov    %esp,%ebp
c0106aa9:	83 ec 18             	sub    $0x18,%esp
    pmm_manager->check();
c0106aac:	a1 ac 8c 12 c0       	mov    0xc0128cac,%eax
c0106ab1:	8b 40 18             	mov    0x18(%eax),%eax
c0106ab4:	ff d0                	call   *%eax
    cprintf("check_alloc_page() succeeded!\n");
c0106ab6:	c7 04 24 54 c2 10 c0 	movl   $0xc010c254,(%esp)
c0106abd:	e8 0a ab ff ff       	call   c01015cc <cprintf>
}
c0106ac2:	c9                   	leave  
c0106ac3:	c3                   	ret    

c0106ac4 <check_pgdir>:

static void
check_pgdir(void) {
c0106ac4:	55                   	push   %ebp
c0106ac5:	89 e5                	mov    %esp,%ebp
c0106ac7:	83 ec 38             	sub    $0x38,%esp
    assert(npage <= KMEMSIZE / PGSIZE);
c0106aca:	a1 00 8a 12 c0       	mov    0xc0128a00,%eax
c0106acf:	3d 00 80 03 00       	cmp    $0x38000,%eax
c0106ad4:	76 24                	jbe    c0106afa <check_pgdir+0x36>
c0106ad6:	c7 44 24 0c 73 c2 10 	movl   $0xc010c273,0xc(%esp)
c0106add:	c0 
c0106ade:	c7 44 24 08 19 c2 10 	movl   $0xc010c219,0x8(%esp)
c0106ae5:	c0 
c0106ae6:	c7 44 24 04 d0 01 00 	movl   $0x1d0,0x4(%esp)
c0106aed:	00 
c0106aee:	c7 04 24 f4 c1 10 c0 	movl   $0xc010c1f4,(%esp)
c0106af5:	e8 b6 bf ff ff       	call   c0102ab0 <__panic>
    assert(boot_pgdir != NULL && (uint32_t)PGOFF(boot_pgdir) == 0);
c0106afa:	a1 04 8a 12 c0       	mov    0xc0128a04,%eax
c0106aff:	85 c0                	test   %eax,%eax
c0106b01:	74 0e                	je     c0106b11 <check_pgdir+0x4d>
c0106b03:	a1 04 8a 12 c0       	mov    0xc0128a04,%eax
c0106b08:	25 ff 0f 00 00       	and    $0xfff,%eax
c0106b0d:	85 c0                	test   %eax,%eax
c0106b0f:	74 24                	je     c0106b35 <check_pgdir+0x71>
c0106b11:	c7 44 24 0c 90 c2 10 	movl   $0xc010c290,0xc(%esp)
c0106b18:	c0 
c0106b19:	c7 44 24 08 19 c2 10 	movl   $0xc010c219,0x8(%esp)
c0106b20:	c0 
c0106b21:	c7 44 24 04 d1 01 00 	movl   $0x1d1,0x4(%esp)
c0106b28:	00 
c0106b29:	c7 04 24 f4 c1 10 c0 	movl   $0xc010c1f4,(%esp)
c0106b30:	e8 7b bf ff ff       	call   c0102ab0 <__panic>
    assert(get_page(boot_pgdir, 0x0, NULL) == NULL);
c0106b35:	a1 04 8a 12 c0       	mov    0xc0128a04,%eax
c0106b3a:	c7 44 24 08 00 00 00 	movl   $0x0,0x8(%esp)
c0106b41:	00 
c0106b42:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
c0106b49:	00 
c0106b4a:	89 04 24             	mov    %eax,(%esp)
c0106b4d:	e8 e2 fc ff ff       	call   c0106834 <get_page>
c0106b52:	85 c0                	test   %eax,%eax
c0106b54:	74 24                	je     c0106b7a <check_pgdir+0xb6>
c0106b56:	c7 44 24 0c c8 c2 10 	movl   $0xc010c2c8,0xc(%esp)
c0106b5d:	c0 
c0106b5e:	c7 44 24 08 19 c2 10 	movl   $0xc010c219,0x8(%esp)
c0106b65:	c0 
c0106b66:	c7 44 24 04 d2 01 00 	movl   $0x1d2,0x4(%esp)
c0106b6d:	00 
c0106b6e:	c7 04 24 f4 c1 10 c0 	movl   $0xc010c1f4,(%esp)
c0106b75:	e8 36 bf ff ff       	call   c0102ab0 <__panic>

    struct Page *p1, *p2;
    p1 = alloc_page();
c0106b7a:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
c0106b81:	e8 48 f4 ff ff       	call   c0105fce <alloc_pages>
c0106b86:	89 45 e4             	mov    %eax,-0x1c(%ebp)
    assert(page_insert(boot_pgdir, p1, 0x0, 0) == 0);
c0106b89:	a1 04 8a 12 c0       	mov    0xc0128a04,%eax
c0106b8e:	c7 44 24 0c 00 00 00 	movl   $0x0,0xc(%esp)
c0106b95:	00 
c0106b96:	c7 44 24 08 00 00 00 	movl   $0x0,0x8(%esp)
c0106b9d:	00 
c0106b9e:	8b 55 e4             	mov    -0x1c(%ebp),%edx
c0106ba1:	89 54 24 04          	mov    %edx,0x4(%esp)
c0106ba5:	89 04 24             	mov    %eax,(%esp)
c0106ba8:	e8 85 fd ff ff       	call   c0106932 <page_insert>
c0106bad:	85 c0                	test   %eax,%eax
c0106baf:	74 24                	je     c0106bd5 <check_pgdir+0x111>
c0106bb1:	c7 44 24 0c f0 c2 10 	movl   $0xc010c2f0,0xc(%esp)
c0106bb8:	c0 
c0106bb9:	c7 44 24 08 19 c2 10 	movl   $0xc010c219,0x8(%esp)
c0106bc0:	c0 
c0106bc1:	c7 44 24 04 d6 01 00 	movl   $0x1d6,0x4(%esp)
c0106bc8:	00 
c0106bc9:	c7 04 24 f4 c1 10 c0 	movl   $0xc010c1f4,(%esp)
c0106bd0:	e8 db be ff ff       	call   c0102ab0 <__panic>

    pte_t *ptep;
    assert((ptep = get_pte(boot_pgdir, 0x0, 0)) != NULL);
c0106bd5:	a1 04 8a 12 c0       	mov    0xc0128a04,%eax
c0106bda:	c7 44 24 08 00 00 00 	movl   $0x0,0x8(%esp)
c0106be1:	00 
c0106be2:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
c0106be9:	00 
c0106bea:	89 04 24             	mov    %eax,(%esp)
c0106bed:	e8 10 fb ff ff       	call   c0106702 <get_pte>
c0106bf2:	89 45 ec             	mov    %eax,-0x14(%ebp)
c0106bf5:	83 7d ec 00          	cmpl   $0x0,-0x14(%ebp)
c0106bf9:	75 24                	jne    c0106c1f <check_pgdir+0x15b>
c0106bfb:	c7 44 24 0c 1c c3 10 	movl   $0xc010c31c,0xc(%esp)
c0106c02:	c0 
c0106c03:	c7 44 24 08 19 c2 10 	movl   $0xc010c219,0x8(%esp)
c0106c0a:	c0 
c0106c0b:	c7 44 24 04 d9 01 00 	movl   $0x1d9,0x4(%esp)
c0106c12:	00 
c0106c13:	c7 04 24 f4 c1 10 c0 	movl   $0xc010c1f4,(%esp)
c0106c1a:	e8 91 be ff ff       	call   c0102ab0 <__panic>
    assert(pa2page(*ptep) == p1);
c0106c1f:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0106c22:	8b 00                	mov    (%eax),%eax
c0106c24:	89 04 24             	mov    %eax,(%esp)
c0106c27:	e8 62 f0 ff ff       	call   c0105c8e <pa2page>
c0106c2c:	3b 45 e4             	cmp    -0x1c(%ebp),%eax
c0106c2f:	74 24                	je     c0106c55 <check_pgdir+0x191>
c0106c31:	c7 44 24 0c 49 c3 10 	movl   $0xc010c349,0xc(%esp)
c0106c38:	c0 
c0106c39:	c7 44 24 08 19 c2 10 	movl   $0xc010c219,0x8(%esp)
c0106c40:	c0 
c0106c41:	c7 44 24 04 da 01 00 	movl   $0x1da,0x4(%esp)
c0106c48:	00 
c0106c49:	c7 04 24 f4 c1 10 c0 	movl   $0xc010c1f4,(%esp)
c0106c50:	e8 5b be ff ff       	call   c0102ab0 <__panic>
    assert(page_ref(p1) == 1);
c0106c55:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0106c58:	89 04 24             	mov    %eax,(%esp)
c0106c5b:	e8 0f f1 ff ff       	call   c0105d6f <page_ref>
c0106c60:	83 f8 01             	cmp    $0x1,%eax
c0106c63:	74 24                	je     c0106c89 <check_pgdir+0x1c5>
c0106c65:	c7 44 24 0c 5e c3 10 	movl   $0xc010c35e,0xc(%esp)
c0106c6c:	c0 
c0106c6d:	c7 44 24 08 19 c2 10 	movl   $0xc010c219,0x8(%esp)
c0106c74:	c0 
c0106c75:	c7 44 24 04 db 01 00 	movl   $0x1db,0x4(%esp)
c0106c7c:	00 
c0106c7d:	c7 04 24 f4 c1 10 c0 	movl   $0xc010c1f4,(%esp)
c0106c84:	e8 27 be ff ff       	call   c0102ab0 <__panic>

    ptep = &((pte_t *)KADDR(PDE_ADDR(boot_pgdir[0])))[1];
c0106c89:	a1 04 8a 12 c0       	mov    0xc0128a04,%eax
c0106c8e:	8b 00                	mov    (%eax),%eax
c0106c90:	25 00 f0 ff ff       	and    $0xfffff000,%eax
c0106c95:	89 45 f0             	mov    %eax,-0x10(%ebp)
c0106c98:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0106c9b:	c1 e8 0c             	shr    $0xc,%eax
c0106c9e:	89 45 f4             	mov    %eax,-0xc(%ebp)
c0106ca1:	a1 00 8a 12 c0       	mov    0xc0128a00,%eax
c0106ca6:	39 45 f4             	cmp    %eax,-0xc(%ebp)
c0106ca9:	72 23                	jb     c0106cce <check_pgdir+0x20a>
c0106cab:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0106cae:	89 44 24 0c          	mov    %eax,0xc(%esp)
c0106cb2:	c7 44 24 08 30 c1 10 	movl   $0xc010c130,0x8(%esp)
c0106cb9:	c0 
c0106cba:	c7 44 24 04 dd 01 00 	movl   $0x1dd,0x4(%esp)
c0106cc1:	00 
c0106cc2:	c7 04 24 f4 c1 10 c0 	movl   $0xc010c1f4,(%esp)
c0106cc9:	e8 e2 bd ff ff       	call   c0102ab0 <__panic>
c0106cce:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0106cd1:	2d 00 00 00 40       	sub    $0x40000000,%eax
c0106cd6:	83 c0 04             	add    $0x4,%eax
c0106cd9:	89 45 ec             	mov    %eax,-0x14(%ebp)
    assert(get_pte(boot_pgdir, PGSIZE, 0) == ptep);
c0106cdc:	a1 04 8a 12 c0       	mov    0xc0128a04,%eax
c0106ce1:	c7 44 24 08 00 00 00 	movl   $0x0,0x8(%esp)
c0106ce8:	00 
c0106ce9:	c7 44 24 04 00 10 00 	movl   $0x1000,0x4(%esp)
c0106cf0:	00 
c0106cf1:	89 04 24             	mov    %eax,(%esp)
c0106cf4:	e8 09 fa ff ff       	call   c0106702 <get_pte>
c0106cf9:	3b 45 ec             	cmp    -0x14(%ebp),%eax
c0106cfc:	74 24                	je     c0106d22 <check_pgdir+0x25e>
c0106cfe:	c7 44 24 0c 70 c3 10 	movl   $0xc010c370,0xc(%esp)
c0106d05:	c0 
c0106d06:	c7 44 24 08 19 c2 10 	movl   $0xc010c219,0x8(%esp)
c0106d0d:	c0 
c0106d0e:	c7 44 24 04 de 01 00 	movl   $0x1de,0x4(%esp)
c0106d15:	00 
c0106d16:	c7 04 24 f4 c1 10 c0 	movl   $0xc010c1f4,(%esp)
c0106d1d:	e8 8e bd ff ff       	call   c0102ab0 <__panic>

    p2 = alloc_page();
c0106d22:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
c0106d29:	e8 a0 f2 ff ff       	call   c0105fce <alloc_pages>
c0106d2e:	89 45 e8             	mov    %eax,-0x18(%ebp)
    assert(page_insert(boot_pgdir, p2, PGSIZE, PTE_U | PTE_W) == 0);
c0106d31:	a1 04 8a 12 c0       	mov    0xc0128a04,%eax
c0106d36:	c7 44 24 0c 06 00 00 	movl   $0x6,0xc(%esp)
c0106d3d:	00 
c0106d3e:	c7 44 24 08 00 10 00 	movl   $0x1000,0x8(%esp)
c0106d45:	00 
c0106d46:	8b 55 e8             	mov    -0x18(%ebp),%edx
c0106d49:	89 54 24 04          	mov    %edx,0x4(%esp)
c0106d4d:	89 04 24             	mov    %eax,(%esp)
c0106d50:	e8 dd fb ff ff       	call   c0106932 <page_insert>
c0106d55:	85 c0                	test   %eax,%eax
c0106d57:	74 24                	je     c0106d7d <check_pgdir+0x2b9>
c0106d59:	c7 44 24 0c 98 c3 10 	movl   $0xc010c398,0xc(%esp)
c0106d60:	c0 
c0106d61:	c7 44 24 08 19 c2 10 	movl   $0xc010c219,0x8(%esp)
c0106d68:	c0 
c0106d69:	c7 44 24 04 e1 01 00 	movl   $0x1e1,0x4(%esp)
c0106d70:	00 
c0106d71:	c7 04 24 f4 c1 10 c0 	movl   $0xc010c1f4,(%esp)
c0106d78:	e8 33 bd ff ff       	call   c0102ab0 <__panic>
    assert((ptep = get_pte(boot_pgdir, PGSIZE, 0)) != NULL);
c0106d7d:	a1 04 8a 12 c0       	mov    0xc0128a04,%eax
c0106d82:	c7 44 24 08 00 00 00 	movl   $0x0,0x8(%esp)
c0106d89:	00 
c0106d8a:	c7 44 24 04 00 10 00 	movl   $0x1000,0x4(%esp)
c0106d91:	00 
c0106d92:	89 04 24             	mov    %eax,(%esp)
c0106d95:	e8 68 f9 ff ff       	call   c0106702 <get_pte>
c0106d9a:	89 45 ec             	mov    %eax,-0x14(%ebp)
c0106d9d:	83 7d ec 00          	cmpl   $0x0,-0x14(%ebp)
c0106da1:	75 24                	jne    c0106dc7 <check_pgdir+0x303>
c0106da3:	c7 44 24 0c d0 c3 10 	movl   $0xc010c3d0,0xc(%esp)
c0106daa:	c0 
c0106dab:	c7 44 24 08 19 c2 10 	movl   $0xc010c219,0x8(%esp)
c0106db2:	c0 
c0106db3:	c7 44 24 04 e2 01 00 	movl   $0x1e2,0x4(%esp)
c0106dba:	00 
c0106dbb:	c7 04 24 f4 c1 10 c0 	movl   $0xc010c1f4,(%esp)
c0106dc2:	e8 e9 bc ff ff       	call   c0102ab0 <__panic>
    assert(*ptep & PTE_U);
c0106dc7:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0106dca:	8b 00                	mov    (%eax),%eax
c0106dcc:	83 e0 04             	and    $0x4,%eax
c0106dcf:	85 c0                	test   %eax,%eax
c0106dd1:	75 24                	jne    c0106df7 <check_pgdir+0x333>
c0106dd3:	c7 44 24 0c 00 c4 10 	movl   $0xc010c400,0xc(%esp)
c0106dda:	c0 
c0106ddb:	c7 44 24 08 19 c2 10 	movl   $0xc010c219,0x8(%esp)
c0106de2:	c0 
c0106de3:	c7 44 24 04 e3 01 00 	movl   $0x1e3,0x4(%esp)
c0106dea:	00 
c0106deb:	c7 04 24 f4 c1 10 c0 	movl   $0xc010c1f4,(%esp)
c0106df2:	e8 b9 bc ff ff       	call   c0102ab0 <__panic>
    assert(*ptep & PTE_W);
c0106df7:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0106dfa:	8b 00                	mov    (%eax),%eax
c0106dfc:	83 e0 02             	and    $0x2,%eax
c0106dff:	85 c0                	test   %eax,%eax
c0106e01:	75 24                	jne    c0106e27 <check_pgdir+0x363>
c0106e03:	c7 44 24 0c 0e c4 10 	movl   $0xc010c40e,0xc(%esp)
c0106e0a:	c0 
c0106e0b:	c7 44 24 08 19 c2 10 	movl   $0xc010c219,0x8(%esp)
c0106e12:	c0 
c0106e13:	c7 44 24 04 e4 01 00 	movl   $0x1e4,0x4(%esp)
c0106e1a:	00 
c0106e1b:	c7 04 24 f4 c1 10 c0 	movl   $0xc010c1f4,(%esp)
c0106e22:	e8 89 bc ff ff       	call   c0102ab0 <__panic>
    assert(boot_pgdir[0] & PTE_U);
c0106e27:	a1 04 8a 12 c0       	mov    0xc0128a04,%eax
c0106e2c:	8b 00                	mov    (%eax),%eax
c0106e2e:	83 e0 04             	and    $0x4,%eax
c0106e31:	85 c0                	test   %eax,%eax
c0106e33:	75 24                	jne    c0106e59 <check_pgdir+0x395>
c0106e35:	c7 44 24 0c 1c c4 10 	movl   $0xc010c41c,0xc(%esp)
c0106e3c:	c0 
c0106e3d:	c7 44 24 08 19 c2 10 	movl   $0xc010c219,0x8(%esp)
c0106e44:	c0 
c0106e45:	c7 44 24 04 e5 01 00 	movl   $0x1e5,0x4(%esp)
c0106e4c:	00 
c0106e4d:	c7 04 24 f4 c1 10 c0 	movl   $0xc010c1f4,(%esp)
c0106e54:	e8 57 bc ff ff       	call   c0102ab0 <__panic>
    assert(page_ref(p2) == 1);
c0106e59:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0106e5c:	89 04 24             	mov    %eax,(%esp)
c0106e5f:	e8 0b ef ff ff       	call   c0105d6f <page_ref>
c0106e64:	83 f8 01             	cmp    $0x1,%eax
c0106e67:	74 24                	je     c0106e8d <check_pgdir+0x3c9>
c0106e69:	c7 44 24 0c 32 c4 10 	movl   $0xc010c432,0xc(%esp)
c0106e70:	c0 
c0106e71:	c7 44 24 08 19 c2 10 	movl   $0xc010c219,0x8(%esp)
c0106e78:	c0 
c0106e79:	c7 44 24 04 e6 01 00 	movl   $0x1e6,0x4(%esp)
c0106e80:	00 
c0106e81:	c7 04 24 f4 c1 10 c0 	movl   $0xc010c1f4,(%esp)
c0106e88:	e8 23 bc ff ff       	call   c0102ab0 <__panic>

    assert(page_insert(boot_pgdir, p1, PGSIZE, 0) == 0);
c0106e8d:	a1 04 8a 12 c0       	mov    0xc0128a04,%eax
c0106e92:	c7 44 24 0c 00 00 00 	movl   $0x0,0xc(%esp)
c0106e99:	00 
c0106e9a:	c7 44 24 08 00 10 00 	movl   $0x1000,0x8(%esp)
c0106ea1:	00 
c0106ea2:	8b 55 e4             	mov    -0x1c(%ebp),%edx
c0106ea5:	89 54 24 04          	mov    %edx,0x4(%esp)
c0106ea9:	89 04 24             	mov    %eax,(%esp)
c0106eac:	e8 81 fa ff ff       	call   c0106932 <page_insert>
c0106eb1:	85 c0                	test   %eax,%eax
c0106eb3:	74 24                	je     c0106ed9 <check_pgdir+0x415>
c0106eb5:	c7 44 24 0c 44 c4 10 	movl   $0xc010c444,0xc(%esp)
c0106ebc:	c0 
c0106ebd:	c7 44 24 08 19 c2 10 	movl   $0xc010c219,0x8(%esp)
c0106ec4:	c0 
c0106ec5:	c7 44 24 04 e8 01 00 	movl   $0x1e8,0x4(%esp)
c0106ecc:	00 
c0106ecd:	c7 04 24 f4 c1 10 c0 	movl   $0xc010c1f4,(%esp)
c0106ed4:	e8 d7 bb ff ff       	call   c0102ab0 <__panic>
    assert(page_ref(p1) == 2);
c0106ed9:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0106edc:	89 04 24             	mov    %eax,(%esp)
c0106edf:	e8 8b ee ff ff       	call   c0105d6f <page_ref>
c0106ee4:	83 f8 02             	cmp    $0x2,%eax
c0106ee7:	74 24                	je     c0106f0d <check_pgdir+0x449>
c0106ee9:	c7 44 24 0c 70 c4 10 	movl   $0xc010c470,0xc(%esp)
c0106ef0:	c0 
c0106ef1:	c7 44 24 08 19 c2 10 	movl   $0xc010c219,0x8(%esp)
c0106ef8:	c0 
c0106ef9:	c7 44 24 04 e9 01 00 	movl   $0x1e9,0x4(%esp)
c0106f00:	00 
c0106f01:	c7 04 24 f4 c1 10 c0 	movl   $0xc010c1f4,(%esp)
c0106f08:	e8 a3 bb ff ff       	call   c0102ab0 <__panic>
    assert(page_ref(p2) == 0);
c0106f0d:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0106f10:	89 04 24             	mov    %eax,(%esp)
c0106f13:	e8 57 ee ff ff       	call   c0105d6f <page_ref>
c0106f18:	85 c0                	test   %eax,%eax
c0106f1a:	74 24                	je     c0106f40 <check_pgdir+0x47c>
c0106f1c:	c7 44 24 0c 82 c4 10 	movl   $0xc010c482,0xc(%esp)
c0106f23:	c0 
c0106f24:	c7 44 24 08 19 c2 10 	movl   $0xc010c219,0x8(%esp)
c0106f2b:	c0 
c0106f2c:	c7 44 24 04 ea 01 00 	movl   $0x1ea,0x4(%esp)
c0106f33:	00 
c0106f34:	c7 04 24 f4 c1 10 c0 	movl   $0xc010c1f4,(%esp)
c0106f3b:	e8 70 bb ff ff       	call   c0102ab0 <__panic>
    assert((ptep = get_pte(boot_pgdir, PGSIZE, 0)) != NULL);
c0106f40:	a1 04 8a 12 c0       	mov    0xc0128a04,%eax
c0106f45:	c7 44 24 08 00 00 00 	movl   $0x0,0x8(%esp)
c0106f4c:	00 
c0106f4d:	c7 44 24 04 00 10 00 	movl   $0x1000,0x4(%esp)
c0106f54:	00 
c0106f55:	89 04 24             	mov    %eax,(%esp)
c0106f58:	e8 a5 f7 ff ff       	call   c0106702 <get_pte>
c0106f5d:	89 45 ec             	mov    %eax,-0x14(%ebp)
c0106f60:	83 7d ec 00          	cmpl   $0x0,-0x14(%ebp)
c0106f64:	75 24                	jne    c0106f8a <check_pgdir+0x4c6>
c0106f66:	c7 44 24 0c d0 c3 10 	movl   $0xc010c3d0,0xc(%esp)
c0106f6d:	c0 
c0106f6e:	c7 44 24 08 19 c2 10 	movl   $0xc010c219,0x8(%esp)
c0106f75:	c0 
c0106f76:	c7 44 24 04 eb 01 00 	movl   $0x1eb,0x4(%esp)
c0106f7d:	00 
c0106f7e:	c7 04 24 f4 c1 10 c0 	movl   $0xc010c1f4,(%esp)
c0106f85:	e8 26 bb ff ff       	call   c0102ab0 <__panic>
    assert(pa2page(*ptep) == p1);
c0106f8a:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0106f8d:	8b 00                	mov    (%eax),%eax
c0106f8f:	89 04 24             	mov    %eax,(%esp)
c0106f92:	e8 f7 ec ff ff       	call   c0105c8e <pa2page>
c0106f97:	3b 45 e4             	cmp    -0x1c(%ebp),%eax
c0106f9a:	74 24                	je     c0106fc0 <check_pgdir+0x4fc>
c0106f9c:	c7 44 24 0c 49 c3 10 	movl   $0xc010c349,0xc(%esp)
c0106fa3:	c0 
c0106fa4:	c7 44 24 08 19 c2 10 	movl   $0xc010c219,0x8(%esp)
c0106fab:	c0 
c0106fac:	c7 44 24 04 ec 01 00 	movl   $0x1ec,0x4(%esp)
c0106fb3:	00 
c0106fb4:	c7 04 24 f4 c1 10 c0 	movl   $0xc010c1f4,(%esp)
c0106fbb:	e8 f0 ba ff ff       	call   c0102ab0 <__panic>
    assert((*ptep & PTE_U) == 0);
c0106fc0:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0106fc3:	8b 00                	mov    (%eax),%eax
c0106fc5:	83 e0 04             	and    $0x4,%eax
c0106fc8:	85 c0                	test   %eax,%eax
c0106fca:	74 24                	je     c0106ff0 <check_pgdir+0x52c>
c0106fcc:	c7 44 24 0c 94 c4 10 	movl   $0xc010c494,0xc(%esp)
c0106fd3:	c0 
c0106fd4:	c7 44 24 08 19 c2 10 	movl   $0xc010c219,0x8(%esp)
c0106fdb:	c0 
c0106fdc:	c7 44 24 04 ed 01 00 	movl   $0x1ed,0x4(%esp)
c0106fe3:	00 
c0106fe4:	c7 04 24 f4 c1 10 c0 	movl   $0xc010c1f4,(%esp)
c0106feb:	e8 c0 ba ff ff       	call   c0102ab0 <__panic>

    page_remove(boot_pgdir, 0x0);
c0106ff0:	a1 04 8a 12 c0       	mov    0xc0128a04,%eax
c0106ff5:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
c0106ffc:	00 
c0106ffd:	89 04 24             	mov    %eax,(%esp)
c0107000:	e8 e9 f8 ff ff       	call   c01068ee <page_remove>
    assert(page_ref(p1) == 1);
c0107005:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0107008:	89 04 24             	mov    %eax,(%esp)
c010700b:	e8 5f ed ff ff       	call   c0105d6f <page_ref>
c0107010:	83 f8 01             	cmp    $0x1,%eax
c0107013:	74 24                	je     c0107039 <check_pgdir+0x575>
c0107015:	c7 44 24 0c 5e c3 10 	movl   $0xc010c35e,0xc(%esp)
c010701c:	c0 
c010701d:	c7 44 24 08 19 c2 10 	movl   $0xc010c219,0x8(%esp)
c0107024:	c0 
c0107025:	c7 44 24 04 f0 01 00 	movl   $0x1f0,0x4(%esp)
c010702c:	00 
c010702d:	c7 04 24 f4 c1 10 c0 	movl   $0xc010c1f4,(%esp)
c0107034:	e8 77 ba ff ff       	call   c0102ab0 <__panic>
    assert(page_ref(p2) == 0);
c0107039:	8b 45 e8             	mov    -0x18(%ebp),%eax
c010703c:	89 04 24             	mov    %eax,(%esp)
c010703f:	e8 2b ed ff ff       	call   c0105d6f <page_ref>
c0107044:	85 c0                	test   %eax,%eax
c0107046:	74 24                	je     c010706c <check_pgdir+0x5a8>
c0107048:	c7 44 24 0c 82 c4 10 	movl   $0xc010c482,0xc(%esp)
c010704f:	c0 
c0107050:	c7 44 24 08 19 c2 10 	movl   $0xc010c219,0x8(%esp)
c0107057:	c0 
c0107058:	c7 44 24 04 f1 01 00 	movl   $0x1f1,0x4(%esp)
c010705f:	00 
c0107060:	c7 04 24 f4 c1 10 c0 	movl   $0xc010c1f4,(%esp)
c0107067:	e8 44 ba ff ff       	call   c0102ab0 <__panic>

    page_remove(boot_pgdir, PGSIZE);
c010706c:	a1 04 8a 12 c0       	mov    0xc0128a04,%eax
c0107071:	c7 44 24 04 00 10 00 	movl   $0x1000,0x4(%esp)
c0107078:	00 
c0107079:	89 04 24             	mov    %eax,(%esp)
c010707c:	e8 6d f8 ff ff       	call   c01068ee <page_remove>
    assert(page_ref(p1) == 0);
c0107081:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0107084:	89 04 24             	mov    %eax,(%esp)
c0107087:	e8 e3 ec ff ff       	call   c0105d6f <page_ref>
c010708c:	85 c0                	test   %eax,%eax
c010708e:	74 24                	je     c01070b4 <check_pgdir+0x5f0>
c0107090:	c7 44 24 0c a9 c4 10 	movl   $0xc010c4a9,0xc(%esp)
c0107097:	c0 
c0107098:	c7 44 24 08 19 c2 10 	movl   $0xc010c219,0x8(%esp)
c010709f:	c0 
c01070a0:	c7 44 24 04 f4 01 00 	movl   $0x1f4,0x4(%esp)
c01070a7:	00 
c01070a8:	c7 04 24 f4 c1 10 c0 	movl   $0xc010c1f4,(%esp)
c01070af:	e8 fc b9 ff ff       	call   c0102ab0 <__panic>
    assert(page_ref(p2) == 0);
c01070b4:	8b 45 e8             	mov    -0x18(%ebp),%eax
c01070b7:	89 04 24             	mov    %eax,(%esp)
c01070ba:	e8 b0 ec ff ff       	call   c0105d6f <page_ref>
c01070bf:	85 c0                	test   %eax,%eax
c01070c1:	74 24                	je     c01070e7 <check_pgdir+0x623>
c01070c3:	c7 44 24 0c 82 c4 10 	movl   $0xc010c482,0xc(%esp)
c01070ca:	c0 
c01070cb:	c7 44 24 08 19 c2 10 	movl   $0xc010c219,0x8(%esp)
c01070d2:	c0 
c01070d3:	c7 44 24 04 f5 01 00 	movl   $0x1f5,0x4(%esp)
c01070da:	00 
c01070db:	c7 04 24 f4 c1 10 c0 	movl   $0xc010c1f4,(%esp)
c01070e2:	e8 c9 b9 ff ff       	call   c0102ab0 <__panic>

    assert(page_ref(pa2page(boot_pgdir[0])) == 1);
c01070e7:	a1 04 8a 12 c0       	mov    0xc0128a04,%eax
c01070ec:	8b 00                	mov    (%eax),%eax
c01070ee:	89 04 24             	mov    %eax,(%esp)
c01070f1:	e8 98 eb ff ff       	call   c0105c8e <pa2page>
c01070f6:	89 04 24             	mov    %eax,(%esp)
c01070f9:	e8 71 ec ff ff       	call   c0105d6f <page_ref>
c01070fe:	83 f8 01             	cmp    $0x1,%eax
c0107101:	74 24                	je     c0107127 <check_pgdir+0x663>
c0107103:	c7 44 24 0c bc c4 10 	movl   $0xc010c4bc,0xc(%esp)
c010710a:	c0 
c010710b:	c7 44 24 08 19 c2 10 	movl   $0xc010c219,0x8(%esp)
c0107112:	c0 
c0107113:	c7 44 24 04 f7 01 00 	movl   $0x1f7,0x4(%esp)
c010711a:	00 
c010711b:	c7 04 24 f4 c1 10 c0 	movl   $0xc010c1f4,(%esp)
c0107122:	e8 89 b9 ff ff       	call   c0102ab0 <__panic>
    free_page(pa2page(boot_pgdir[0]));
c0107127:	a1 04 8a 12 c0       	mov    0xc0128a04,%eax
c010712c:	8b 00                	mov    (%eax),%eax
c010712e:	89 04 24             	mov    %eax,(%esp)
c0107131:	e8 58 eb ff ff       	call   c0105c8e <pa2page>
c0107136:	c7 44 24 04 01 00 00 	movl   $0x1,0x4(%esp)
c010713d:	00 
c010713e:	89 04 24             	mov    %eax,(%esp)
c0107141:	e8 b9 ee ff ff       	call   c0105fff <free_pages>
    boot_pgdir[0] = 0;
c0107146:	a1 04 8a 12 c0       	mov    0xc0128a04,%eax
c010714b:	c7 00 00 00 00 00    	movl   $0x0,(%eax)

    cprintf("check_pgdir() succeeded!\n");
c0107151:	c7 04 24 e2 c4 10 c0 	movl   $0xc010c4e2,(%esp)
c0107158:	e8 6f a4 ff ff       	call   c01015cc <cprintf>
}
c010715d:	c9                   	leave  
c010715e:	c3                   	ret    

c010715f <check_boot_pgdir>:

static void
check_boot_pgdir(void) {
c010715f:	55                   	push   %ebp
c0107160:	89 e5                	mov    %esp,%ebp
c0107162:	83 ec 38             	sub    $0x38,%esp
    pte_t *ptep;
    int i;
    for (i = 0; i < npage; i += PGSIZE) {
c0107165:	c7 45 e0 00 00 00 00 	movl   $0x0,-0x20(%ebp)
c010716c:	e9 cb 00 00 00       	jmp    c010723c <check_boot_pgdir+0xdd>
        assert((ptep = get_pte(boot_pgdir, (uintptr_t)KADDR(i), 0)) != NULL);
c0107171:	8b 45 e0             	mov    -0x20(%ebp),%eax
c0107174:	89 45 ec             	mov    %eax,-0x14(%ebp)
c0107177:	8b 45 ec             	mov    -0x14(%ebp),%eax
c010717a:	c1 e8 0c             	shr    $0xc,%eax
c010717d:	89 45 f0             	mov    %eax,-0x10(%ebp)
c0107180:	a1 00 8a 12 c0       	mov    0xc0128a00,%eax
c0107185:	39 45 f0             	cmp    %eax,-0x10(%ebp)
c0107188:	72 23                	jb     c01071ad <check_boot_pgdir+0x4e>
c010718a:	8b 45 ec             	mov    -0x14(%ebp),%eax
c010718d:	89 44 24 0c          	mov    %eax,0xc(%esp)
c0107191:	c7 44 24 08 30 c1 10 	movl   $0xc010c130,0x8(%esp)
c0107198:	c0 
c0107199:	c7 44 24 04 03 02 00 	movl   $0x203,0x4(%esp)
c01071a0:	00 
c01071a1:	c7 04 24 f4 c1 10 c0 	movl   $0xc010c1f4,(%esp)
c01071a8:	e8 03 b9 ff ff       	call   c0102ab0 <__panic>
c01071ad:	8b 45 ec             	mov    -0x14(%ebp),%eax
c01071b0:	2d 00 00 00 40       	sub    $0x40000000,%eax
c01071b5:	89 c2                	mov    %eax,%edx
c01071b7:	a1 04 8a 12 c0       	mov    0xc0128a04,%eax
c01071bc:	c7 44 24 08 00 00 00 	movl   $0x0,0x8(%esp)
c01071c3:	00 
c01071c4:	89 54 24 04          	mov    %edx,0x4(%esp)
c01071c8:	89 04 24             	mov    %eax,(%esp)
c01071cb:	e8 32 f5 ff ff       	call   c0106702 <get_pte>
c01071d0:	89 45 dc             	mov    %eax,-0x24(%ebp)
c01071d3:	83 7d dc 00          	cmpl   $0x0,-0x24(%ebp)
c01071d7:	75 24                	jne    c01071fd <check_boot_pgdir+0x9e>
c01071d9:	c7 44 24 0c fc c4 10 	movl   $0xc010c4fc,0xc(%esp)
c01071e0:	c0 
c01071e1:	c7 44 24 08 19 c2 10 	movl   $0xc010c219,0x8(%esp)
c01071e8:	c0 
c01071e9:	c7 44 24 04 03 02 00 	movl   $0x203,0x4(%esp)
c01071f0:	00 
c01071f1:	c7 04 24 f4 c1 10 c0 	movl   $0xc010c1f4,(%esp)
c01071f8:	e8 b3 b8 ff ff       	call   c0102ab0 <__panic>
        assert(PTE_ADDR(*ptep) == i);
c01071fd:	8b 45 dc             	mov    -0x24(%ebp),%eax
c0107200:	8b 00                	mov    (%eax),%eax
c0107202:	89 c2                	mov    %eax,%edx
c0107204:	81 e2 00 f0 ff ff    	and    $0xfffff000,%edx
c010720a:	8b 45 e0             	mov    -0x20(%ebp),%eax
c010720d:	39 c2                	cmp    %eax,%edx
c010720f:	74 24                	je     c0107235 <check_boot_pgdir+0xd6>
c0107211:	c7 44 24 0c 39 c5 10 	movl   $0xc010c539,0xc(%esp)
c0107218:	c0 
c0107219:	c7 44 24 08 19 c2 10 	movl   $0xc010c219,0x8(%esp)
c0107220:	c0 
c0107221:	c7 44 24 04 04 02 00 	movl   $0x204,0x4(%esp)
c0107228:	00 
c0107229:	c7 04 24 f4 c1 10 c0 	movl   $0xc010c1f4,(%esp)
c0107230:	e8 7b b8 ff ff       	call   c0102ab0 <__panic>

static void
check_boot_pgdir(void) {
    pte_t *ptep;
    int i;
    for (i = 0; i < npage; i += PGSIZE) {
c0107235:	81 45 e0 00 10 00 00 	addl   $0x1000,-0x20(%ebp)
c010723c:	8b 55 e0             	mov    -0x20(%ebp),%edx
c010723f:	a1 00 8a 12 c0       	mov    0xc0128a00,%eax
c0107244:	39 c2                	cmp    %eax,%edx
c0107246:	0f 82 25 ff ff ff    	jb     c0107171 <check_boot_pgdir+0x12>
        assert((ptep = get_pte(boot_pgdir, (uintptr_t)KADDR(i), 0)) != NULL);
        assert(PTE_ADDR(*ptep) == i);
    }

    assert(PDE_ADDR(boot_pgdir[PDX(VPT)]) == PADDR(boot_pgdir));
c010724c:	a1 04 8a 12 c0       	mov    0xc0128a04,%eax
c0107251:	05 ac 0f 00 00       	add    $0xfac,%eax
c0107256:	8b 00                	mov    (%eax),%eax
c0107258:	89 c2                	mov    %eax,%edx
c010725a:	81 e2 00 f0 ff ff    	and    $0xfffff000,%edx
c0107260:	a1 04 8a 12 c0       	mov    0xc0128a04,%eax
c0107265:	89 45 f4             	mov    %eax,-0xc(%ebp)
c0107268:	81 7d f4 ff ff ff bf 	cmpl   $0xbfffffff,-0xc(%ebp)
c010726f:	77 23                	ja     c0107294 <check_boot_pgdir+0x135>
c0107271:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0107274:	89 44 24 0c          	mov    %eax,0xc(%esp)
c0107278:	c7 44 24 08 d0 c1 10 	movl   $0xc010c1d0,0x8(%esp)
c010727f:	c0 
c0107280:	c7 44 24 04 07 02 00 	movl   $0x207,0x4(%esp)
c0107287:	00 
c0107288:	c7 04 24 f4 c1 10 c0 	movl   $0xc010c1f4,(%esp)
c010728f:	e8 1c b8 ff ff       	call   c0102ab0 <__panic>
c0107294:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0107297:	05 00 00 00 40       	add    $0x40000000,%eax
c010729c:	39 c2                	cmp    %eax,%edx
c010729e:	74 24                	je     c01072c4 <check_boot_pgdir+0x165>
c01072a0:	c7 44 24 0c 50 c5 10 	movl   $0xc010c550,0xc(%esp)
c01072a7:	c0 
c01072a8:	c7 44 24 08 19 c2 10 	movl   $0xc010c219,0x8(%esp)
c01072af:	c0 
c01072b0:	c7 44 24 04 07 02 00 	movl   $0x207,0x4(%esp)
c01072b7:	00 
c01072b8:	c7 04 24 f4 c1 10 c0 	movl   $0xc010c1f4,(%esp)
c01072bf:	e8 ec b7 ff ff       	call   c0102ab0 <__panic>

    assert(boot_pgdir[0] == 0);
c01072c4:	a1 04 8a 12 c0       	mov    0xc0128a04,%eax
c01072c9:	8b 00                	mov    (%eax),%eax
c01072cb:	85 c0                	test   %eax,%eax
c01072cd:	74 24                	je     c01072f3 <check_boot_pgdir+0x194>
c01072cf:	c7 44 24 0c 84 c5 10 	movl   $0xc010c584,0xc(%esp)
c01072d6:	c0 
c01072d7:	c7 44 24 08 19 c2 10 	movl   $0xc010c219,0x8(%esp)
c01072de:	c0 
c01072df:	c7 44 24 04 09 02 00 	movl   $0x209,0x4(%esp)
c01072e6:	00 
c01072e7:	c7 04 24 f4 c1 10 c0 	movl   $0xc010c1f4,(%esp)
c01072ee:	e8 bd b7 ff ff       	call   c0102ab0 <__panic>

    struct Page *p;
    p = alloc_page();
c01072f3:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
c01072fa:	e8 cf ec ff ff       	call   c0105fce <alloc_pages>
c01072ff:	89 45 e4             	mov    %eax,-0x1c(%ebp)
    assert(page_insert(boot_pgdir, p, 0x100, PTE_W) == 0);
c0107302:	a1 04 8a 12 c0       	mov    0xc0128a04,%eax
c0107307:	c7 44 24 0c 02 00 00 	movl   $0x2,0xc(%esp)
c010730e:	00 
c010730f:	c7 44 24 08 00 01 00 	movl   $0x100,0x8(%esp)
c0107316:	00 
c0107317:	8b 55 e4             	mov    -0x1c(%ebp),%edx
c010731a:	89 54 24 04          	mov    %edx,0x4(%esp)
c010731e:	89 04 24             	mov    %eax,(%esp)
c0107321:	e8 0c f6 ff ff       	call   c0106932 <page_insert>
c0107326:	85 c0                	test   %eax,%eax
c0107328:	74 24                	je     c010734e <check_boot_pgdir+0x1ef>
c010732a:	c7 44 24 0c 98 c5 10 	movl   $0xc010c598,0xc(%esp)
c0107331:	c0 
c0107332:	c7 44 24 08 19 c2 10 	movl   $0xc010c219,0x8(%esp)
c0107339:	c0 
c010733a:	c7 44 24 04 0d 02 00 	movl   $0x20d,0x4(%esp)
c0107341:	00 
c0107342:	c7 04 24 f4 c1 10 c0 	movl   $0xc010c1f4,(%esp)
c0107349:	e8 62 b7 ff ff       	call   c0102ab0 <__panic>
    assert(page_ref(p) == 1);
c010734e:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0107351:	89 04 24             	mov    %eax,(%esp)
c0107354:	e8 16 ea ff ff       	call   c0105d6f <page_ref>
c0107359:	83 f8 01             	cmp    $0x1,%eax
c010735c:	74 24                	je     c0107382 <check_boot_pgdir+0x223>
c010735e:	c7 44 24 0c c6 c5 10 	movl   $0xc010c5c6,0xc(%esp)
c0107365:	c0 
c0107366:	c7 44 24 08 19 c2 10 	movl   $0xc010c219,0x8(%esp)
c010736d:	c0 
c010736e:	c7 44 24 04 0e 02 00 	movl   $0x20e,0x4(%esp)
c0107375:	00 
c0107376:	c7 04 24 f4 c1 10 c0 	movl   $0xc010c1f4,(%esp)
c010737d:	e8 2e b7 ff ff       	call   c0102ab0 <__panic>
    assert(page_insert(boot_pgdir, p, 0x100 + PGSIZE, PTE_W) == 0);
c0107382:	a1 04 8a 12 c0       	mov    0xc0128a04,%eax
c0107387:	c7 44 24 0c 02 00 00 	movl   $0x2,0xc(%esp)
c010738e:	00 
c010738f:	c7 44 24 08 00 11 00 	movl   $0x1100,0x8(%esp)
c0107396:	00 
c0107397:	8b 55 e4             	mov    -0x1c(%ebp),%edx
c010739a:	89 54 24 04          	mov    %edx,0x4(%esp)
c010739e:	89 04 24             	mov    %eax,(%esp)
c01073a1:	e8 8c f5 ff ff       	call   c0106932 <page_insert>
c01073a6:	85 c0                	test   %eax,%eax
c01073a8:	74 24                	je     c01073ce <check_boot_pgdir+0x26f>
c01073aa:	c7 44 24 0c d8 c5 10 	movl   $0xc010c5d8,0xc(%esp)
c01073b1:	c0 
c01073b2:	c7 44 24 08 19 c2 10 	movl   $0xc010c219,0x8(%esp)
c01073b9:	c0 
c01073ba:	c7 44 24 04 0f 02 00 	movl   $0x20f,0x4(%esp)
c01073c1:	00 
c01073c2:	c7 04 24 f4 c1 10 c0 	movl   $0xc010c1f4,(%esp)
c01073c9:	e8 e2 b6 ff ff       	call   c0102ab0 <__panic>
    assert(page_ref(p) == 2);
c01073ce:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c01073d1:	89 04 24             	mov    %eax,(%esp)
c01073d4:	e8 96 e9 ff ff       	call   c0105d6f <page_ref>
c01073d9:	83 f8 02             	cmp    $0x2,%eax
c01073dc:	74 24                	je     c0107402 <check_boot_pgdir+0x2a3>
c01073de:	c7 44 24 0c 0f c6 10 	movl   $0xc010c60f,0xc(%esp)
c01073e5:	c0 
c01073e6:	c7 44 24 08 19 c2 10 	movl   $0xc010c219,0x8(%esp)
c01073ed:	c0 
c01073ee:	c7 44 24 04 10 02 00 	movl   $0x210,0x4(%esp)
c01073f5:	00 
c01073f6:	c7 04 24 f4 c1 10 c0 	movl   $0xc010c1f4,(%esp)
c01073fd:	e8 ae b6 ff ff       	call   c0102ab0 <__panic>

    const char *str = "ucore: Hello world!!";
c0107402:	c7 45 e8 20 c6 10 c0 	movl   $0xc010c620,-0x18(%ebp)
    strcpy((void *)0x100, str);
c0107409:	8b 45 e8             	mov    -0x18(%ebp),%eax
c010740c:	89 44 24 04          	mov    %eax,0x4(%esp)
c0107410:	c7 04 24 00 01 00 00 	movl   $0x100,(%esp)
c0107417:	e8 52 35 00 00       	call   c010a96e <strcpy>
    assert(strcmp((void *)0x100, (void *)(0x100 + PGSIZE)) == 0);
c010741c:	c7 44 24 04 00 11 00 	movl   $0x1100,0x4(%esp)
c0107423:	00 
c0107424:	c7 04 24 00 01 00 00 	movl   $0x100,(%esp)
c010742b:	e8 b7 35 00 00       	call   c010a9e7 <strcmp>
c0107430:	85 c0                	test   %eax,%eax
c0107432:	74 24                	je     c0107458 <check_boot_pgdir+0x2f9>
c0107434:	c7 44 24 0c 38 c6 10 	movl   $0xc010c638,0xc(%esp)
c010743b:	c0 
c010743c:	c7 44 24 08 19 c2 10 	movl   $0xc010c219,0x8(%esp)
c0107443:	c0 
c0107444:	c7 44 24 04 14 02 00 	movl   $0x214,0x4(%esp)
c010744b:	00 
c010744c:	c7 04 24 f4 c1 10 c0 	movl   $0xc010c1f4,(%esp)
c0107453:	e8 58 b6 ff ff       	call   c0102ab0 <__panic>

    *(char *)(page2kva(p) + 0x100) = '\0';
c0107458:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c010745b:	89 04 24             	mov    %eax,(%esp)
c010745e:	e8 7a e8 ff ff       	call   c0105cdd <page2kva>
c0107463:	05 00 01 00 00       	add    $0x100,%eax
c0107468:	c6 00 00             	movb   $0x0,(%eax)
    assert(strlen((const char *)0x100) == 0);
c010746b:	c7 04 24 00 01 00 00 	movl   $0x100,(%esp)
c0107472:	e8 99 34 00 00       	call   c010a910 <strlen>
c0107477:	85 c0                	test   %eax,%eax
c0107479:	74 24                	je     c010749f <check_boot_pgdir+0x340>
c010747b:	c7 44 24 0c 70 c6 10 	movl   $0xc010c670,0xc(%esp)
c0107482:	c0 
c0107483:	c7 44 24 08 19 c2 10 	movl   $0xc010c219,0x8(%esp)
c010748a:	c0 
c010748b:	c7 44 24 04 17 02 00 	movl   $0x217,0x4(%esp)
c0107492:	00 
c0107493:	c7 04 24 f4 c1 10 c0 	movl   $0xc010c1f4,(%esp)
c010749a:	e8 11 b6 ff ff       	call   c0102ab0 <__panic>

    free_page(p);
c010749f:	c7 44 24 04 01 00 00 	movl   $0x1,0x4(%esp)
c01074a6:	00 
c01074a7:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c01074aa:	89 04 24             	mov    %eax,(%esp)
c01074ad:	e8 4d eb ff ff       	call   c0105fff <free_pages>
    free_page(pa2page(PDE_ADDR(boot_pgdir[0])));
c01074b2:	a1 04 8a 12 c0       	mov    0xc0128a04,%eax
c01074b7:	8b 00                	mov    (%eax),%eax
c01074b9:	25 00 f0 ff ff       	and    $0xfffff000,%eax
c01074be:	89 04 24             	mov    %eax,(%esp)
c01074c1:	e8 c8 e7 ff ff       	call   c0105c8e <pa2page>
c01074c6:	c7 44 24 04 01 00 00 	movl   $0x1,0x4(%esp)
c01074cd:	00 
c01074ce:	89 04 24             	mov    %eax,(%esp)
c01074d1:	e8 29 eb ff ff       	call   c0105fff <free_pages>
    boot_pgdir[0] = 0;
c01074d6:	a1 04 8a 12 c0       	mov    0xc0128a04,%eax
c01074db:	c7 00 00 00 00 00    	movl   $0x0,(%eax)

    cprintf("check_boot_pgdir() succeeded!\n");
c01074e1:	c7 04 24 94 c6 10 c0 	movl   $0xc010c694,(%esp)
c01074e8:	e8 df a0 ff ff       	call   c01015cc <cprintf>
}
c01074ed:	c9                   	leave  
c01074ee:	c3                   	ret    

c01074ef <perm2str>:

//perm2str - use string 'u,r,w,-' to present the permission
static const char *
perm2str(int perm) {
c01074ef:	55                   	push   %ebp
c01074f0:	89 e5                	mov    %esp,%ebp
    static char str[4];
    str[0] = (perm & PTE_U) ? 'u' : '-';
c01074f2:	8b 45 08             	mov    0x8(%ebp),%eax
c01074f5:	83 e0 04             	and    $0x4,%eax
c01074f8:	85 c0                	test   %eax,%eax
c01074fa:	74 07                	je     c0107503 <perm2str+0x14>
c01074fc:	b8 75 00 00 00       	mov    $0x75,%eax
c0107501:	eb 05                	jmp    c0107508 <perm2str+0x19>
c0107503:	b8 2d 00 00 00       	mov    $0x2d,%eax
c0107508:	a2 88 8a 12 c0       	mov    %al,0xc0128a88
    str[1] = 'r';
c010750d:	c6 05 89 8a 12 c0 72 	movb   $0x72,0xc0128a89
    str[2] = (perm & PTE_W) ? 'w' : '-';
c0107514:	8b 45 08             	mov    0x8(%ebp),%eax
c0107517:	83 e0 02             	and    $0x2,%eax
c010751a:	85 c0                	test   %eax,%eax
c010751c:	74 07                	je     c0107525 <perm2str+0x36>
c010751e:	b8 77 00 00 00       	mov    $0x77,%eax
c0107523:	eb 05                	jmp    c010752a <perm2str+0x3b>
c0107525:	b8 2d 00 00 00       	mov    $0x2d,%eax
c010752a:	a2 8a 8a 12 c0       	mov    %al,0xc0128a8a
    str[3] = '\0';
c010752f:	c6 05 8b 8a 12 c0 00 	movb   $0x0,0xc0128a8b
    return str;
c0107536:	b8 88 8a 12 c0       	mov    $0xc0128a88,%eax
}
c010753b:	5d                   	pop    %ebp
c010753c:	c3                   	ret    

c010753d <get_pgtable_items>:
//  table:       the beginning addr of table
//  left_store:  the pointer of the high side of table's next range
//  right_store: the pointer of the low side of table's next range
// return value: 0 - not a invalid item range, perm - a valid item range with perm permission 
static int
get_pgtable_items(size_t left, size_t right, size_t start, uintptr_t *table, size_t *left_store, size_t *right_store) {
c010753d:	55                   	push   %ebp
c010753e:	89 e5                	mov    %esp,%ebp
c0107540:	83 ec 10             	sub    $0x10,%esp
    if (start >= right) {
c0107543:	8b 45 10             	mov    0x10(%ebp),%eax
c0107546:	3b 45 0c             	cmp    0xc(%ebp),%eax
c0107549:	72 0e                	jb     c0107559 <get_pgtable_items+0x1c>
        return 0;
c010754b:	b8 00 00 00 00       	mov    $0x0,%eax
c0107550:	e9 86 00 00 00       	jmp    c01075db <get_pgtable_items+0x9e>
    }
    while (start < right && !(table[start] & PTE_P)) {
        start ++;
c0107555:	83 45 10 01          	addl   $0x1,0x10(%ebp)
static int
get_pgtable_items(size_t left, size_t right, size_t start, uintptr_t *table, size_t *left_store, size_t *right_store) {
    if (start >= right) {
        return 0;
    }
    while (start < right && !(table[start] & PTE_P)) {
c0107559:	8b 45 10             	mov    0x10(%ebp),%eax
c010755c:	3b 45 0c             	cmp    0xc(%ebp),%eax
c010755f:	73 12                	jae    c0107573 <get_pgtable_items+0x36>
c0107561:	8b 45 10             	mov    0x10(%ebp),%eax
c0107564:	c1 e0 02             	shl    $0x2,%eax
c0107567:	03 45 14             	add    0x14(%ebp),%eax
c010756a:	8b 00                	mov    (%eax),%eax
c010756c:	83 e0 01             	and    $0x1,%eax
c010756f:	85 c0                	test   %eax,%eax
c0107571:	74 e2                	je     c0107555 <get_pgtable_items+0x18>
        start ++;
    }
    if (start < right) {
c0107573:	8b 45 10             	mov    0x10(%ebp),%eax
c0107576:	3b 45 0c             	cmp    0xc(%ebp),%eax
c0107579:	73 5b                	jae    c01075d6 <get_pgtable_items+0x99>
        if (left_store != NULL) {
c010757b:	83 7d 18 00          	cmpl   $0x0,0x18(%ebp)
c010757f:	74 08                	je     c0107589 <get_pgtable_items+0x4c>
            *left_store = start;
c0107581:	8b 45 18             	mov    0x18(%ebp),%eax
c0107584:	8b 55 10             	mov    0x10(%ebp),%edx
c0107587:	89 10                	mov    %edx,(%eax)
        }
        int perm = (table[start ++] & PTE_USER);
c0107589:	8b 45 10             	mov    0x10(%ebp),%eax
c010758c:	c1 e0 02             	shl    $0x2,%eax
c010758f:	03 45 14             	add    0x14(%ebp),%eax
c0107592:	8b 00                	mov    (%eax),%eax
c0107594:	83 e0 07             	and    $0x7,%eax
c0107597:	89 45 fc             	mov    %eax,-0x4(%ebp)
c010759a:	83 45 10 01          	addl   $0x1,0x10(%ebp)
        while (start < right && (table[start] & PTE_USER) == perm) {
c010759e:	eb 04                	jmp    c01075a4 <get_pgtable_items+0x67>
            start ++;
c01075a0:	83 45 10 01          	addl   $0x1,0x10(%ebp)
    if (start < right) {
        if (left_store != NULL) {
            *left_store = start;
        }
        int perm = (table[start ++] & PTE_USER);
        while (start < right && (table[start] & PTE_USER) == perm) {
c01075a4:	8b 45 10             	mov    0x10(%ebp),%eax
c01075a7:	3b 45 0c             	cmp    0xc(%ebp),%eax
c01075aa:	73 17                	jae    c01075c3 <get_pgtable_items+0x86>
c01075ac:	8b 45 10             	mov    0x10(%ebp),%eax
c01075af:	c1 e0 02             	shl    $0x2,%eax
c01075b2:	03 45 14             	add    0x14(%ebp),%eax
c01075b5:	8b 00                	mov    (%eax),%eax
c01075b7:	89 c2                	mov    %eax,%edx
c01075b9:	83 e2 07             	and    $0x7,%edx
c01075bc:	8b 45 fc             	mov    -0x4(%ebp),%eax
c01075bf:	39 c2                	cmp    %eax,%edx
c01075c1:	74 dd                	je     c01075a0 <get_pgtable_items+0x63>
            start ++;
        }
        if (right_store != NULL) {
c01075c3:	83 7d 1c 00          	cmpl   $0x0,0x1c(%ebp)
c01075c7:	74 08                	je     c01075d1 <get_pgtable_items+0x94>
            *right_store = start;
c01075c9:	8b 45 1c             	mov    0x1c(%ebp),%eax
c01075cc:	8b 55 10             	mov    0x10(%ebp),%edx
c01075cf:	89 10                	mov    %edx,(%eax)
        }
        return perm;
c01075d1:	8b 45 fc             	mov    -0x4(%ebp),%eax
c01075d4:	eb 05                	jmp    c01075db <get_pgtable_items+0x9e>
    }
    return 0;
c01075d6:	b8 00 00 00 00       	mov    $0x0,%eax
}
c01075db:	c9                   	leave  
c01075dc:	c3                   	ret    

c01075dd <print_pgdir>:

//print_pgdir - print the PDT&PT
void
print_pgdir(void) {
c01075dd:	55                   	push   %ebp
c01075de:	89 e5                	mov    %esp,%ebp
c01075e0:	57                   	push   %edi
c01075e1:	56                   	push   %esi
c01075e2:	53                   	push   %ebx
c01075e3:	83 ec 5c             	sub    $0x5c,%esp
    cprintf("-------------------- BEGIN --------------------\n");
c01075e6:	c7 04 24 b4 c6 10 c0 	movl   $0xc010c6b4,(%esp)
c01075ed:	e8 da 9f ff ff       	call   c01015cc <cprintf>
    size_t left, right = 0, perm;
c01075f2:	c7 45 dc 00 00 00 00 	movl   $0x0,-0x24(%ebp)
    while ((perm = get_pgtable_items(0, NPDEENTRY, right, vpd, &left, &right)) != 0) {
c01075f9:	e9 0b 01 00 00       	jmp    c0107709 <print_pgdir+0x12c>
        cprintf("PDE(%03x) %08x-%08x %08x %s\n", right - left,
c01075fe:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0107601:	89 04 24             	mov    %eax,(%esp)
c0107604:	e8 e6 fe ff ff       	call   c01074ef <perm2str>
                left * PTSIZE, right * PTSIZE, (right - left) * PTSIZE, perm2str(perm));
c0107609:	8b 4d dc             	mov    -0x24(%ebp),%ecx
c010760c:	8b 55 e0             	mov    -0x20(%ebp),%edx
c010760f:	89 cb                	mov    %ecx,%ebx
c0107611:	29 d3                	sub    %edx,%ebx
c0107613:	89 da                	mov    %ebx,%edx
void
print_pgdir(void) {
    cprintf("-------------------- BEGIN --------------------\n");
    size_t left, right = 0, perm;
    while ((perm = get_pgtable_items(0, NPDEENTRY, right, vpd, &left, &right)) != 0) {
        cprintf("PDE(%03x) %08x-%08x %08x %s\n", right - left,
c0107615:	89 d6                	mov    %edx,%esi
c0107617:	c1 e6 16             	shl    $0x16,%esi
c010761a:	8b 55 dc             	mov    -0x24(%ebp),%edx
c010761d:	89 d3                	mov    %edx,%ebx
c010761f:	c1 e3 16             	shl    $0x16,%ebx
c0107622:	8b 55 e0             	mov    -0x20(%ebp),%edx
c0107625:	89 d1                	mov    %edx,%ecx
c0107627:	c1 e1 16             	shl    $0x16,%ecx
c010762a:	8b 7d dc             	mov    -0x24(%ebp),%edi
c010762d:	89 7d c4             	mov    %edi,-0x3c(%ebp)
c0107630:	8b 55 e0             	mov    -0x20(%ebp),%edx
c0107633:	8b 7d c4             	mov    -0x3c(%ebp),%edi
c0107636:	29 d7                	sub    %edx,%edi
c0107638:	89 fa                	mov    %edi,%edx
c010763a:	89 44 24 14          	mov    %eax,0x14(%esp)
c010763e:	89 74 24 10          	mov    %esi,0x10(%esp)
c0107642:	89 5c 24 0c          	mov    %ebx,0xc(%esp)
c0107646:	89 4c 24 08          	mov    %ecx,0x8(%esp)
c010764a:	89 54 24 04          	mov    %edx,0x4(%esp)
c010764e:	c7 04 24 e5 c6 10 c0 	movl   $0xc010c6e5,(%esp)
c0107655:	e8 72 9f ff ff       	call   c01015cc <cprintf>
                left * PTSIZE, right * PTSIZE, (right - left) * PTSIZE, perm2str(perm));
        size_t l, r = left * NPTEENTRY;
c010765a:	8b 45 e0             	mov    -0x20(%ebp),%eax
c010765d:	c1 e0 0a             	shl    $0xa,%eax
c0107660:	89 45 d4             	mov    %eax,-0x2c(%ebp)
        while ((perm = get_pgtable_items(left * NPTEENTRY, right * NPTEENTRY, r, vpt, &l, &r)) != 0) {
c0107663:	eb 5c                	jmp    c01076c1 <print_pgdir+0xe4>
            cprintf("  |-- PTE(%05x) %08x-%08x %08x %s\n", r - l,
c0107665:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0107668:	89 04 24             	mov    %eax,(%esp)
c010766b:	e8 7f fe ff ff       	call   c01074ef <perm2str>
                    l * PGSIZE, r * PGSIZE, (r - l) * PGSIZE, perm2str(perm));
c0107670:	8b 4d d4             	mov    -0x2c(%ebp),%ecx
c0107673:	8b 55 d8             	mov    -0x28(%ebp),%edx
c0107676:	89 cb                	mov    %ecx,%ebx
c0107678:	29 d3                	sub    %edx,%ebx
c010767a:	89 da                	mov    %ebx,%edx
    while ((perm = get_pgtable_items(0, NPDEENTRY, right, vpd, &left, &right)) != 0) {
        cprintf("PDE(%03x) %08x-%08x %08x %s\n", right - left,
                left * PTSIZE, right * PTSIZE, (right - left) * PTSIZE, perm2str(perm));
        size_t l, r = left * NPTEENTRY;
        while ((perm = get_pgtable_items(left * NPTEENTRY, right * NPTEENTRY, r, vpt, &l, &r)) != 0) {
            cprintf("  |-- PTE(%05x) %08x-%08x %08x %s\n", r - l,
c010767c:	89 d6                	mov    %edx,%esi
c010767e:	c1 e6 0c             	shl    $0xc,%esi
c0107681:	8b 55 d4             	mov    -0x2c(%ebp),%edx
c0107684:	89 d3                	mov    %edx,%ebx
c0107686:	c1 e3 0c             	shl    $0xc,%ebx
c0107689:	8b 55 d8             	mov    -0x28(%ebp),%edx
c010768c:	89 d1                	mov    %edx,%ecx
c010768e:	c1 e1 0c             	shl    $0xc,%ecx
c0107691:	8b 7d d4             	mov    -0x2c(%ebp),%edi
c0107694:	89 7d c4             	mov    %edi,-0x3c(%ebp)
c0107697:	8b 55 d8             	mov    -0x28(%ebp),%edx
c010769a:	8b 7d c4             	mov    -0x3c(%ebp),%edi
c010769d:	29 d7                	sub    %edx,%edi
c010769f:	89 fa                	mov    %edi,%edx
c01076a1:	89 44 24 14          	mov    %eax,0x14(%esp)
c01076a5:	89 74 24 10          	mov    %esi,0x10(%esp)
c01076a9:	89 5c 24 0c          	mov    %ebx,0xc(%esp)
c01076ad:	89 4c 24 08          	mov    %ecx,0x8(%esp)
c01076b1:	89 54 24 04          	mov    %edx,0x4(%esp)
c01076b5:	c7 04 24 04 c7 10 c0 	movl   $0xc010c704,(%esp)
c01076bc:	e8 0b 9f ff ff       	call   c01015cc <cprintf>
    size_t left, right = 0, perm;
    while ((perm = get_pgtable_items(0, NPDEENTRY, right, vpd, &left, &right)) != 0) {
        cprintf("PDE(%03x) %08x-%08x %08x %s\n", right - left,
                left * PTSIZE, right * PTSIZE, (right - left) * PTSIZE, perm2str(perm));
        size_t l, r = left * NPTEENTRY;
        while ((perm = get_pgtable_items(left * NPTEENTRY, right * NPTEENTRY, r, vpt, &l, &r)) != 0) {
c01076c1:	8b 15 78 c1 10 c0    	mov    0xc010c178,%edx
c01076c7:	8b 45 d4             	mov    -0x2c(%ebp),%eax
c01076ca:	8b 4d dc             	mov    -0x24(%ebp),%ecx
c01076cd:	89 ce                	mov    %ecx,%esi
c01076cf:	c1 e6 0a             	shl    $0xa,%esi
c01076d2:	8b 4d e0             	mov    -0x20(%ebp),%ecx
c01076d5:	89 cb                	mov    %ecx,%ebx
c01076d7:	c1 e3 0a             	shl    $0xa,%ebx
c01076da:	8d 4d d4             	lea    -0x2c(%ebp),%ecx
c01076dd:	89 4c 24 14          	mov    %ecx,0x14(%esp)
c01076e1:	8d 4d d8             	lea    -0x28(%ebp),%ecx
c01076e4:	89 4c 24 10          	mov    %ecx,0x10(%esp)
c01076e8:	89 54 24 0c          	mov    %edx,0xc(%esp)
c01076ec:	89 44 24 08          	mov    %eax,0x8(%esp)
c01076f0:	89 74 24 04          	mov    %esi,0x4(%esp)
c01076f4:	89 1c 24             	mov    %ebx,(%esp)
c01076f7:	e8 41 fe ff ff       	call   c010753d <get_pgtable_items>
c01076fc:	89 45 e4             	mov    %eax,-0x1c(%ebp)
c01076ff:	83 7d e4 00          	cmpl   $0x0,-0x1c(%ebp)
c0107703:	0f 85 5c ff ff ff    	jne    c0107665 <print_pgdir+0x88>
//print_pgdir - print the PDT&PT
void
print_pgdir(void) {
    cprintf("-------------------- BEGIN --------------------\n");
    size_t left, right = 0, perm;
    while ((perm = get_pgtable_items(0, NPDEENTRY, right, vpd, &left, &right)) != 0) {
c0107709:	8b 15 7c c1 10 c0    	mov    0xc010c17c,%edx
c010770f:	8b 45 dc             	mov    -0x24(%ebp),%eax
c0107712:	8d 4d dc             	lea    -0x24(%ebp),%ecx
c0107715:	89 4c 24 14          	mov    %ecx,0x14(%esp)
c0107719:	8d 4d e0             	lea    -0x20(%ebp),%ecx
c010771c:	89 4c 24 10          	mov    %ecx,0x10(%esp)
c0107720:	89 54 24 0c          	mov    %edx,0xc(%esp)
c0107724:	89 44 24 08          	mov    %eax,0x8(%esp)
c0107728:	c7 44 24 04 00 04 00 	movl   $0x400,0x4(%esp)
c010772f:	00 
c0107730:	c7 04 24 00 00 00 00 	movl   $0x0,(%esp)
c0107737:	e8 01 fe ff ff       	call   c010753d <get_pgtable_items>
c010773c:	89 45 e4             	mov    %eax,-0x1c(%ebp)
c010773f:	83 7d e4 00          	cmpl   $0x0,-0x1c(%ebp)
c0107743:	0f 85 b5 fe ff ff    	jne    c01075fe <print_pgdir+0x21>
        while ((perm = get_pgtable_items(left * NPTEENTRY, right * NPTEENTRY, r, vpt, &l, &r)) != 0) {
            cprintf("  |-- PTE(%05x) %08x-%08x %08x %s\n", r - l,
                    l * PGSIZE, r * PGSIZE, (r - l) * PGSIZE, perm2str(perm));
        }
    }
    cprintf("--------------------- END ---------------------\n");
c0107749:	c7 04 24 28 c7 10 c0 	movl   $0xc010c728,(%esp)
c0107750:	e8 77 9e ff ff       	call   c01015cc <cprintf>
}
c0107755:	83 c4 5c             	add    $0x5c,%esp
c0107758:	5b                   	pop    %ebx
c0107759:	5e                   	pop    %esi
c010775a:	5f                   	pop    %edi
c010775b:	5d                   	pop    %ebp
c010775c:	c3                   	ret    
c010775d:	00 00                	add    %al,(%eax)
	...

c0107760 <__intr_save>:
#include <x86.h>
#include <intr.h>
#include <mmu.h>

static inline bool
__intr_save(void) {
c0107760:	55                   	push   %ebp
c0107761:	89 e5                	mov    %esp,%ebp
c0107763:	83 ec 18             	sub    $0x18,%esp
}

static inline uint32_t
read_eflags(void) {
    uint32_t eflags;
    asm volatile ("pushfl; popl %0" : "=r" (eflags));
c0107766:	9c                   	pushf  
c0107767:	58                   	pop    %eax
c0107768:	89 45 f4             	mov    %eax,-0xc(%ebp)
    return eflags;
c010776b:	8b 45 f4             	mov    -0xc(%ebp),%eax
    if (read_eflags() & FL_IF) {
c010776e:	25 00 02 00 00       	and    $0x200,%eax
c0107773:	85 c0                	test   %eax,%eax
c0107775:	74 0c                	je     c0107783 <__intr_save+0x23>
        intr_disable();
c0107777:	e8 26 bd ff ff       	call   c01034a2 <intr_disable>
        return 1;
c010777c:	b8 01 00 00 00       	mov    $0x1,%eax
c0107781:	eb 05                	jmp    c0107788 <__intr_save+0x28>
    }
    return 0;
c0107783:	b8 00 00 00 00       	mov    $0x0,%eax
}
c0107788:	c9                   	leave  
c0107789:	c3                   	ret    

c010778a <__intr_restore>:

static inline void
__intr_restore(bool flag) {
c010778a:	55                   	push   %ebp
c010778b:	89 e5                	mov    %esp,%ebp
c010778d:	83 ec 08             	sub    $0x8,%esp
    if (flag) {
c0107790:	83 7d 08 00          	cmpl   $0x0,0x8(%ebp)
c0107794:	74 05                	je     c010779b <__intr_restore+0x11>
        intr_enable();
c0107796:	e8 01 bd ff ff       	call   c010349c <intr_enable>
    }
}
c010779b:	c9                   	leave  
c010779c:	c3                   	ret    

c010779d <page2ppn>:

extern struct Page *pages;
extern size_t npage;

static inline ppn_t
page2ppn(struct Page *page) {
c010779d:	55                   	push   %ebp
c010779e:	89 e5                	mov    %esp,%ebp
    return page - pages;
c01077a0:	8b 55 08             	mov    0x8(%ebp),%edx
c01077a3:	a1 b4 8c 12 c0       	mov    0xc0128cb4,%eax
c01077a8:	89 d1                	mov    %edx,%ecx
c01077aa:	29 c1                	sub    %eax,%ecx
c01077ac:	89 c8                	mov    %ecx,%eax
c01077ae:	c1 f8 03             	sar    $0x3,%eax
c01077b1:	69 c0 ab aa aa aa    	imul   $0xaaaaaaab,%eax,%eax
}
c01077b7:	5d                   	pop    %ebp
c01077b8:	c3                   	ret    

c01077b9 <page2pa>:

static inline uintptr_t
page2pa(struct Page *page) {
c01077b9:	55                   	push   %ebp
c01077ba:	89 e5                	mov    %esp,%ebp
c01077bc:	83 ec 04             	sub    $0x4,%esp
    return page2ppn(page) << PGSHIFT;
c01077bf:	8b 45 08             	mov    0x8(%ebp),%eax
c01077c2:	89 04 24             	mov    %eax,(%esp)
c01077c5:	e8 d3 ff ff ff       	call   c010779d <page2ppn>
c01077ca:	c1 e0 0c             	shl    $0xc,%eax
}
c01077cd:	c9                   	leave  
c01077ce:	c3                   	ret    

c01077cf <pa2page>:

static inline struct Page *
pa2page(uintptr_t pa) {
c01077cf:	55                   	push   %ebp
c01077d0:	89 e5                	mov    %esp,%ebp
c01077d2:	83 ec 18             	sub    $0x18,%esp
    if (PPN(pa) >= npage) {
c01077d5:	8b 45 08             	mov    0x8(%ebp),%eax
c01077d8:	89 c2                	mov    %eax,%edx
c01077da:	c1 ea 0c             	shr    $0xc,%edx
c01077dd:	a1 00 8a 12 c0       	mov    0xc0128a00,%eax
c01077e2:	39 c2                	cmp    %eax,%edx
c01077e4:	72 1c                	jb     c0107802 <pa2page+0x33>
        panic("pa2page called with invalid pa");
c01077e6:	c7 44 24 08 5c c7 10 	movl   $0xc010c75c,0x8(%esp)
c01077ed:	c0 
c01077ee:	c7 44 24 04 5b 00 00 	movl   $0x5b,0x4(%esp)
c01077f5:	00 
c01077f6:	c7 04 24 7b c7 10 c0 	movl   $0xc010c77b,(%esp)
c01077fd:	e8 ae b2 ff ff       	call   c0102ab0 <__panic>
    }
    return &pages[PPN(pa)];
c0107802:	8b 0d b4 8c 12 c0    	mov    0xc0128cb4,%ecx
c0107808:	8b 45 08             	mov    0x8(%ebp),%eax
c010780b:	89 c2                	mov    %eax,%edx
c010780d:	c1 ea 0c             	shr    $0xc,%edx
c0107810:	89 d0                	mov    %edx,%eax
c0107812:	01 c0                	add    %eax,%eax
c0107814:	01 d0                	add    %edx,%eax
c0107816:	c1 e0 03             	shl    $0x3,%eax
c0107819:	8d 04 01             	lea    (%ecx,%eax,1),%eax
}
c010781c:	c9                   	leave  
c010781d:	c3                   	ret    

c010781e <page2kva>:

static inline void *
page2kva(struct Page *page) {
c010781e:	55                   	push   %ebp
c010781f:	89 e5                	mov    %esp,%ebp
c0107821:	83 ec 28             	sub    $0x28,%esp
    return KADDR(page2pa(page));
c0107824:	8b 45 08             	mov    0x8(%ebp),%eax
c0107827:	89 04 24             	mov    %eax,(%esp)
c010782a:	e8 8a ff ff ff       	call   c01077b9 <page2pa>
c010782f:	89 45 f0             	mov    %eax,-0x10(%ebp)
c0107832:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0107835:	c1 e8 0c             	shr    $0xc,%eax
c0107838:	89 45 f4             	mov    %eax,-0xc(%ebp)
c010783b:	a1 00 8a 12 c0       	mov    0xc0128a00,%eax
c0107840:	39 45 f4             	cmp    %eax,-0xc(%ebp)
c0107843:	72 23                	jb     c0107868 <page2kva+0x4a>
c0107845:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0107848:	89 44 24 0c          	mov    %eax,0xc(%esp)
c010784c:	c7 44 24 08 8c c7 10 	movl   $0xc010c78c,0x8(%esp)
c0107853:	c0 
c0107854:	c7 44 24 04 62 00 00 	movl   $0x62,0x4(%esp)
c010785b:	00 
c010785c:	c7 04 24 7b c7 10 c0 	movl   $0xc010c77b,(%esp)
c0107863:	e8 48 b2 ff ff       	call   c0102ab0 <__panic>
c0107868:	8b 45 f0             	mov    -0x10(%ebp),%eax
c010786b:	2d 00 00 00 40       	sub    $0x40000000,%eax
}
c0107870:	c9                   	leave  
c0107871:	c3                   	ret    

c0107872 <kva2page>:

static inline struct Page *
kva2page(void *kva) {
c0107872:	55                   	push   %ebp
c0107873:	89 e5                	mov    %esp,%ebp
c0107875:	83 ec 28             	sub    $0x28,%esp
    return pa2page(PADDR(kva));
c0107878:	8b 45 08             	mov    0x8(%ebp),%eax
c010787b:	89 45 f4             	mov    %eax,-0xc(%ebp)
c010787e:	81 7d f4 ff ff ff bf 	cmpl   $0xbfffffff,-0xc(%ebp)
c0107885:	77 23                	ja     c01078aa <kva2page+0x38>
c0107887:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010788a:	89 44 24 0c          	mov    %eax,0xc(%esp)
c010788e:	c7 44 24 08 b0 c7 10 	movl   $0xc010c7b0,0x8(%esp)
c0107895:	c0 
c0107896:	c7 44 24 04 67 00 00 	movl   $0x67,0x4(%esp)
c010789d:	00 
c010789e:	c7 04 24 7b c7 10 c0 	movl   $0xc010c77b,(%esp)
c01078a5:	e8 06 b2 ff ff       	call   c0102ab0 <__panic>
c01078aa:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01078ad:	05 00 00 00 40       	add    $0x40000000,%eax
c01078b2:	89 04 24             	mov    %eax,(%esp)
c01078b5:	e8 15 ff ff ff       	call   c01077cf <pa2page>
}
c01078ba:	c9                   	leave  
c01078bb:	c3                   	ret    

c01078bc <slab_init>:
static void init_kmem_cache(kmem_cache_t *cachep, size_t objsize, size_t align);
static void check_slab(void);

//slab_init - call init_kmem_cache function to reset the slab_cache array
void
slab_init(void) {
c01078bc:	55                   	push   %ebp
c01078bd:	89 e5                	mov    %esp,%ebp
c01078bf:	53                   	push   %ebx
c01078c0:	83 ec 24             	sub    $0x24,%esp
    size_t i;
    //the align bit for obj in slab. 2^n could be better for performance
    size_t align = 16;
c01078c3:	c7 45 f4 10 00 00 00 	movl   $0x10,-0xc(%ebp)
    for (i = 0; i < SLAB_CACHE_NUM; i ++) {
c01078ca:	c7 45 f0 00 00 00 00 	movl   $0x0,-0x10(%ebp)
c01078d1:	eb 3f                	jmp    c0107912 <slab_init+0x56>
        init_kmem_cache(slab_cache + i, 1 << (i + MIN_SIZE_ORDER), align);
c01078d3:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01078d6:	83 c0 05             	add    $0x5,%eax
c01078d9:	ba 01 00 00 00       	mov    $0x1,%edx
c01078de:	89 d3                	mov    %edx,%ebx
c01078e0:	89 c1                	mov    %eax,%ecx
c01078e2:	d3 e3                	shl    %cl,%ebx
c01078e4:	89 d8                	mov    %ebx,%eax
c01078e6:	89 c1                	mov    %eax,%ecx
c01078e8:	8b 55 f0             	mov    -0x10(%ebp),%edx
c01078eb:	89 d0                	mov    %edx,%eax
c01078ed:	c1 e0 02             	shl    $0x2,%eax
c01078f0:	01 d0                	add    %edx,%eax
c01078f2:	c1 e0 03             	shl    $0x3,%eax
c01078f5:	8d 90 a0 8a 12 c0    	lea    -0x3fed7560(%eax),%edx
c01078fb:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01078fe:	89 44 24 08          	mov    %eax,0x8(%esp)
c0107902:	89 4c 24 04          	mov    %ecx,0x4(%esp)
c0107906:	89 14 24             	mov    %edx,(%esp)
c0107909:	e8 51 03 00 00       	call   c0107c5f <init_kmem_cache>
void
slab_init(void) {
    size_t i;
    //the align bit for obj in slab. 2^n could be better for performance
    size_t align = 16;
    for (i = 0; i < SLAB_CACHE_NUM; i ++) {
c010790e:	83 45 f0 01          	addl   $0x1,-0x10(%ebp)
c0107912:	83 7d f0 0c          	cmpl   $0xc,-0x10(%ebp)
c0107916:	76 bb                	jbe    c01078d3 <slab_init+0x17>
        init_kmem_cache(slab_cache + i, 1 << (i + MIN_SIZE_ORDER), align);
    }
    check_slab();
c0107918:	e8 20 0c 00 00       	call   c010853d <check_slab>
}
c010791d:	83 c4 24             	add    $0x24,%esp
c0107920:	5b                   	pop    %ebx
c0107921:	5d                   	pop    %ebp
c0107922:	c3                   	ret    

c0107923 <slab_allocated>:

//slab_allocated - summary the total size of allocated objs
size_t
slab_allocated(void) {
c0107923:	55                   	push   %ebp
c0107924:	89 e5                	mov    %esp,%ebp
c0107926:	83 ec 48             	sub    $0x48,%esp
    size_t total = 0;
c0107929:	c7 45 d4 00 00 00 00 	movl   $0x0,-0x2c(%ebp)
    int i;
    bool intr_flag;
    local_intr_save(intr_flag);
c0107930:	e8 2b fe ff ff       	call   c0107760 <__intr_save>
c0107935:	89 45 dc             	mov    %eax,-0x24(%ebp)
    {
        for (i = 0; i < SLAB_CACHE_NUM; i ++) {
c0107938:	c7 45 d8 00 00 00 00 	movl   $0x0,-0x28(%ebp)
c010793f:	e9 90 00 00 00       	jmp    c01079d4 <slab_allocated+0xb1>
            kmem_cache_t *cachep = slab_cache + i;
c0107944:	8b 55 d8             	mov    -0x28(%ebp),%edx
c0107947:	89 d0                	mov    %edx,%eax
c0107949:	c1 e0 02             	shl    $0x2,%eax
c010794c:	01 d0                	add    %edx,%eax
c010794e:	c1 e0 03             	shl    $0x3,%eax
c0107951:	05 a0 8a 12 c0       	add    $0xc0128aa0,%eax
c0107956:	89 45 e0             	mov    %eax,-0x20(%ebp)
            list_entry_t *list, *le;
            list = le = &(cachep->slabs_full);
c0107959:	8b 45 e0             	mov    -0x20(%ebp),%eax
c010795c:	89 45 e8             	mov    %eax,-0x18(%ebp)
c010795f:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0107962:	89 45 e4             	mov    %eax,-0x1c(%ebp)
            while ((le = list_next(le)) != list) {
c0107965:	eb 12                	jmp    c0107979 <slab_allocated+0x56>
                total += cachep->num * cachep->objsize;
c0107967:	8b 45 e0             	mov    -0x20(%ebp),%eax
c010796a:	8b 50 14             	mov    0x14(%eax),%edx
c010796d:	8b 45 e0             	mov    -0x20(%ebp),%eax
c0107970:	8b 40 10             	mov    0x10(%eax),%eax
c0107973:	0f af c2             	imul   %edx,%eax
c0107976:	01 45 d4             	add    %eax,-0x2c(%ebp)
c0107979:	8b 45 e8             	mov    -0x18(%ebp),%eax
c010797c:	89 45 f0             	mov    %eax,-0x10(%ebp)
c010797f:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0107982:	8b 40 04             	mov    0x4(%eax),%eax
    {
        for (i = 0; i < SLAB_CACHE_NUM; i ++) {
            kmem_cache_t *cachep = slab_cache + i;
            list_entry_t *list, *le;
            list = le = &(cachep->slabs_full);
            while ((le = list_next(le)) != list) {
c0107985:	89 45 e8             	mov    %eax,-0x18(%ebp)
c0107988:	8b 45 e8             	mov    -0x18(%ebp),%eax
c010798b:	3b 45 e4             	cmp    -0x1c(%ebp),%eax
c010798e:	75 d7                	jne    c0107967 <slab_allocated+0x44>
                total += cachep->num * cachep->objsize;
            }
            list = le = &(cachep->slabs_notfull);
c0107990:	8b 45 e0             	mov    -0x20(%ebp),%eax
c0107993:	83 c0 08             	add    $0x8,%eax
c0107996:	89 45 e8             	mov    %eax,-0x18(%ebp)
c0107999:	8b 45 e8             	mov    -0x18(%ebp),%eax
c010799c:	89 45 e4             	mov    %eax,-0x1c(%ebp)
            while ((le = list_next(le)) != list) {
c010799f:	eb 18                	jmp    c01079b9 <slab_allocated+0x96>
                slab_t *slabp = le2slab(le, slab_link);
c01079a1:	8b 45 e8             	mov    -0x18(%ebp),%eax
c01079a4:	89 45 ec             	mov    %eax,-0x14(%ebp)
                total += slabp->inuse * cachep->objsize;
c01079a7:	8b 45 ec             	mov    -0x14(%ebp),%eax
c01079aa:	8b 50 0c             	mov    0xc(%eax),%edx
c01079ad:	8b 45 e0             	mov    -0x20(%ebp),%eax
c01079b0:	8b 40 10             	mov    0x10(%eax),%eax
c01079b3:	0f af c2             	imul   %edx,%eax
c01079b6:	01 45 d4             	add    %eax,-0x2c(%ebp)
c01079b9:	8b 45 e8             	mov    -0x18(%ebp),%eax
c01079bc:	89 45 f4             	mov    %eax,-0xc(%ebp)
c01079bf:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01079c2:	8b 40 04             	mov    0x4(%eax),%eax
            list = le = &(cachep->slabs_full);
            while ((le = list_next(le)) != list) {
                total += cachep->num * cachep->objsize;
            }
            list = le = &(cachep->slabs_notfull);
            while ((le = list_next(le)) != list) {
c01079c5:	89 45 e8             	mov    %eax,-0x18(%ebp)
c01079c8:	8b 45 e8             	mov    -0x18(%ebp),%eax
c01079cb:	3b 45 e4             	cmp    -0x1c(%ebp),%eax
c01079ce:	75 d1                	jne    c01079a1 <slab_allocated+0x7e>
    size_t total = 0;
    int i;
    bool intr_flag;
    local_intr_save(intr_flag);
    {
        for (i = 0; i < SLAB_CACHE_NUM; i ++) {
c01079d0:	83 45 d8 01          	addl   $0x1,-0x28(%ebp)
c01079d4:	83 7d d8 0c          	cmpl   $0xc,-0x28(%ebp)
c01079d8:	0f 8e 66 ff ff ff    	jle    c0107944 <slab_allocated+0x21>
                slab_t *slabp = le2slab(le, slab_link);
                total += slabp->inuse * cachep->objsize;
            }
        }
    }
    local_intr_restore(intr_flag);
c01079de:	8b 45 dc             	mov    -0x24(%ebp),%eax
c01079e1:	89 04 24             	mov    %eax,(%esp)
c01079e4:	e8 a1 fd ff ff       	call   c010778a <__intr_restore>
    return total;
c01079e9:	8b 45 d4             	mov    -0x2c(%ebp),%eax
}
c01079ec:	c9                   	leave  
c01079ed:	c3                   	ret    

c01079ee <slab_mgmt_size>:

// slab_mgmt_size - get the size of slab control area (slab_t+num*kmem_bufctl_t)
static size_t
slab_mgmt_size(size_t num, size_t align) {
c01079ee:	55                   	push   %ebp
c01079ef:	89 e5                	mov    %esp,%ebp
c01079f1:	83 ec 10             	sub    $0x10,%esp
    return ROUNDUP(sizeof(slab_t) + num * sizeof(kmem_bufctl_t), align);
c01079f4:	8b 45 0c             	mov    0xc(%ebp),%eax
c01079f7:	89 45 f8             	mov    %eax,-0x8(%ebp)
c01079fa:	8b 45 08             	mov    0x8(%ebp),%eax
c01079fd:	83 c0 06             	add    $0x6,%eax
c0107a00:	c1 e0 02             	shl    $0x2,%eax
c0107a03:	03 45 f8             	add    -0x8(%ebp),%eax
c0107a06:	83 e8 01             	sub    $0x1,%eax
c0107a09:	89 45 fc             	mov    %eax,-0x4(%ebp)
c0107a0c:	8b 45 fc             	mov    -0x4(%ebp),%eax
c0107a0f:	ba 00 00 00 00       	mov    $0x0,%edx
c0107a14:	f7 75 f8             	divl   -0x8(%ebp)
c0107a17:	89 d0                	mov    %edx,%eax
c0107a19:	8b 55 fc             	mov    -0x4(%ebp),%edx
c0107a1c:	89 d1                	mov    %edx,%ecx
c0107a1e:	29 c1                	sub    %eax,%ecx
c0107a20:	89 c8                	mov    %ecx,%eax
}
c0107a22:	c9                   	leave  
c0107a23:	c3                   	ret    

c0107a24 <cache_estimate>:

// cacahe_estimate - estimate the number of objs in a slab
static void
cache_estimate(size_t order, size_t objsize, size_t align, bool off_slab, size_t *remainder, size_t *num) {
c0107a24:	55                   	push   %ebp
c0107a25:	89 e5                	mov    %esp,%ebp
c0107a27:	53                   	push   %ebx
c0107a28:	83 ec 1c             	sub    $0x1c,%esp
    size_t nr_objs, mgmt_size;
    size_t slab_size = (PGSIZE << order);
c0107a2b:	8b 45 08             	mov    0x8(%ebp),%eax
c0107a2e:	ba 00 10 00 00       	mov    $0x1000,%edx
c0107a33:	89 d3                	mov    %edx,%ebx
c0107a35:	89 c1                	mov    %eax,%ecx
c0107a37:	d3 e3                	shl    %cl,%ebx
c0107a39:	89 d8                	mov    %ebx,%eax
c0107a3b:	89 45 f8             	mov    %eax,-0x8(%ebp)

    if (off_slab) {
c0107a3e:	83 7d 14 00          	cmpl   $0x0,0x14(%ebp)
c0107a42:	74 24                	je     c0107a68 <cache_estimate+0x44>
        mgmt_size = 0;
c0107a44:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
        nr_objs = slab_size / objsize;
c0107a4b:	8b 45 f8             	mov    -0x8(%ebp),%eax
c0107a4e:	ba 00 00 00 00       	mov    $0x0,%edx
c0107a53:	f7 75 0c             	divl   0xc(%ebp)
c0107a56:	89 45 f0             	mov    %eax,-0x10(%ebp)
        if (nr_objs > SLAB_LIMIT) {
c0107a59:	83 7d f0 ff          	cmpl   $0xffffffff,-0x10(%ebp)
c0107a5d:	75 6b                	jne    c0107aca <cache_estimate+0xa6>
            nr_objs = SLAB_LIMIT;
c0107a5f:	c7 45 f0 fe ff ff ff 	movl   $0xfffffffe,-0x10(%ebp)
c0107a66:	eb 62                	jmp    c0107aca <cache_estimate+0xa6>
        }
    }
    else {
        nr_objs = (slab_size - sizeof(slab_t)) / (objsize + sizeof(kmem_bufctl_t));
c0107a68:	8b 45 f8             	mov    -0x8(%ebp),%eax
c0107a6b:	83 e8 18             	sub    $0x18,%eax
c0107a6e:	8b 55 0c             	mov    0xc(%ebp),%edx
c0107a71:	83 c2 04             	add    $0x4,%edx
c0107a74:	89 55 e8             	mov    %edx,-0x18(%ebp)
c0107a77:	ba 00 00 00 00       	mov    $0x0,%edx
c0107a7c:	f7 75 e8             	divl   -0x18(%ebp)
c0107a7f:	89 45 f0             	mov    %eax,-0x10(%ebp)
        while (slab_mgmt_size(nr_objs, align) + nr_objs * objsize > slab_size) {
c0107a82:	eb 04                	jmp    c0107a88 <cache_estimate+0x64>
            nr_objs --;
c0107a84:	83 6d f0 01          	subl   $0x1,-0x10(%ebp)
            nr_objs = SLAB_LIMIT;
        }
    }
    else {
        nr_objs = (slab_size - sizeof(slab_t)) / (objsize + sizeof(kmem_bufctl_t));
        while (slab_mgmt_size(nr_objs, align) + nr_objs * objsize > slab_size) {
c0107a88:	8b 45 10             	mov    0x10(%ebp),%eax
c0107a8b:	89 44 24 04          	mov    %eax,0x4(%esp)
c0107a8f:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0107a92:	89 04 24             	mov    %eax,(%esp)
c0107a95:	e8 54 ff ff ff       	call   c01079ee <slab_mgmt_size>
c0107a9a:	8b 55 f0             	mov    -0x10(%ebp),%edx
c0107a9d:	0f af 55 0c          	imul   0xc(%ebp),%edx
c0107aa1:	01 d0                	add    %edx,%eax
c0107aa3:	3b 45 f8             	cmp    -0x8(%ebp),%eax
c0107aa6:	77 dc                	ja     c0107a84 <cache_estimate+0x60>
            nr_objs --;
        }
        if (nr_objs > SLAB_LIMIT) {
c0107aa8:	83 7d f0 ff          	cmpl   $0xffffffff,-0x10(%ebp)
c0107aac:	75 07                	jne    c0107ab5 <cache_estimate+0x91>
            nr_objs = SLAB_LIMIT;
c0107aae:	c7 45 f0 fe ff ff ff 	movl   $0xfffffffe,-0x10(%ebp)
        }
        mgmt_size = slab_mgmt_size(nr_objs, align);
c0107ab5:	8b 45 10             	mov    0x10(%ebp),%eax
c0107ab8:	89 44 24 04          	mov    %eax,0x4(%esp)
c0107abc:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0107abf:	89 04 24             	mov    %eax,(%esp)
c0107ac2:	e8 27 ff ff ff       	call   c01079ee <slab_mgmt_size>
c0107ac7:	89 45 f4             	mov    %eax,-0xc(%ebp)
    }
    *num = nr_objs;
c0107aca:	8b 45 1c             	mov    0x1c(%ebp),%eax
c0107acd:	8b 55 f0             	mov    -0x10(%ebp),%edx
c0107ad0:	89 10                	mov    %edx,(%eax)
    *remainder = slab_size - nr_objs * objsize - mgmt_size;
c0107ad2:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0107ad5:	0f af 45 0c          	imul   0xc(%ebp),%eax
c0107ad9:	8b 55 f8             	mov    -0x8(%ebp),%edx
c0107adc:	89 d1                	mov    %edx,%ecx
c0107ade:	29 c1                	sub    %eax,%ecx
c0107ae0:	89 c8                	mov    %ecx,%eax
c0107ae2:	89 c2                	mov    %eax,%edx
c0107ae4:	2b 55 f4             	sub    -0xc(%ebp),%edx
c0107ae7:	8b 45 18             	mov    0x18(%ebp),%eax
c0107aea:	89 10                	mov    %edx,(%eax)
}
c0107aec:	83 c4 1c             	add    $0x1c,%esp
c0107aef:	5b                   	pop    %ebx
c0107af0:	5d                   	pop    %ebp
c0107af1:	c3                   	ret    

c0107af2 <calculate_slab_order>:
//   objsize:   the size of obj
//   align:     align bit for objs
//   off_slab:  the control part of slab in slab or not
//   left_over: the size of can not be used area in slab
static void
calculate_slab_order(kmem_cache_t *cachep, size_t objsize, size_t align, bool off_slab, size_t *left_over) {
c0107af2:	55                   	push   %ebp
c0107af3:	89 e5                	mov    %esp,%ebp
c0107af5:	56                   	push   %esi
c0107af6:	53                   	push   %ebx
c0107af7:	83 ec 30             	sub    $0x30,%esp
    size_t order;
    for (order = 0; order <= KMALLOC_MAX_ORDER; order ++) {
c0107afa:	c7 45 f0 00 00 00 00 	movl   $0x0,-0x10(%ebp)
c0107b01:	e9 c7 00 00 00       	jmp    c0107bcd <calculate_slab_order+0xdb>
        size_t num, remainder;
        cache_estimate(order, objsize, align, off_slab, &remainder, &num);
c0107b06:	8d 45 ec             	lea    -0x14(%ebp),%eax
c0107b09:	89 44 24 14          	mov    %eax,0x14(%esp)
c0107b0d:	8d 45 e8             	lea    -0x18(%ebp),%eax
c0107b10:	89 44 24 10          	mov    %eax,0x10(%esp)
c0107b14:	8b 45 14             	mov    0x14(%ebp),%eax
c0107b17:	89 44 24 0c          	mov    %eax,0xc(%esp)
c0107b1b:	8b 45 10             	mov    0x10(%ebp),%eax
c0107b1e:	89 44 24 08          	mov    %eax,0x8(%esp)
c0107b22:	8b 45 0c             	mov    0xc(%ebp),%eax
c0107b25:	89 44 24 04          	mov    %eax,0x4(%esp)
c0107b29:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0107b2c:	89 04 24             	mov    %eax,(%esp)
c0107b2f:	e8 f0 fe ff ff       	call   c0107a24 <cache_estimate>
        if (num != 0) {
c0107b34:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0107b37:	85 c0                	test   %eax,%eax
c0107b39:	0f 84 8a 00 00 00    	je     c0107bc9 <calculate_slab_order+0xd7>
            if (off_slab) {
c0107b3f:	83 7d 14 00          	cmpl   $0x0,0x14(%ebp)
c0107b43:	74 44                	je     c0107b89 <calculate_slab_order+0x97>
                size_t off_slab_limit = objsize - sizeof(slab_t);
c0107b45:	8b 45 0c             	mov    0xc(%ebp),%eax
c0107b48:	83 e8 18             	sub    $0x18,%eax
c0107b4b:	89 45 f4             	mov    %eax,-0xc(%ebp)
                off_slab_limit /= sizeof(kmem_bufctl_t);
c0107b4e:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0107b51:	c1 e8 02             	shr    $0x2,%eax
c0107b54:	89 45 f4             	mov    %eax,-0xc(%ebp)
                if (num > off_slab_limit) {
c0107b57:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0107b5a:	3b 45 f4             	cmp    -0xc(%ebp),%eax
c0107b5d:	76 2a                	jbe    c0107b89 <calculate_slab_order+0x97>
                    panic("off_slab: objsize = %d, num = %d.", objsize, num);
c0107b5f:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0107b62:	89 44 24 10          	mov    %eax,0x10(%esp)
c0107b66:	8b 45 0c             	mov    0xc(%ebp),%eax
c0107b69:	89 44 24 0c          	mov    %eax,0xc(%esp)
c0107b6d:	c7 44 24 08 d4 c7 10 	movl   $0xc010c7d4,0x8(%esp)
c0107b74:	c0 
c0107b75:	c7 44 24 04 c5 00 00 	movl   $0xc5,0x4(%esp)
c0107b7c:	00 
c0107b7d:	c7 04 24 f6 c7 10 c0 	movl   $0xc010c7f6,(%esp)
c0107b84:	e8 27 af ff ff       	call   c0102ab0 <__panic>
                }
            }
            if (remainder * 8 <= (PGSIZE << order)) {
c0107b89:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0107b8c:	8d 1c c5 00 00 00 00 	lea    0x0(,%eax,8),%ebx
c0107b93:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0107b96:	ba 00 10 00 00       	mov    $0x1000,%edx
c0107b9b:	89 d6                	mov    %edx,%esi
c0107b9d:	89 c1                	mov    %eax,%ecx
c0107b9f:	d3 e6                	shl    %cl,%esi
c0107ba1:	89 f0                	mov    %esi,%eax
c0107ba3:	39 c3                	cmp    %eax,%ebx
c0107ba5:	77 22                	ja     c0107bc9 <calculate_slab_order+0xd7>
                cachep->num = num;
c0107ba7:	8b 55 ec             	mov    -0x14(%ebp),%edx
c0107baa:	8b 45 08             	mov    0x8(%ebp),%eax
c0107bad:	89 50 14             	mov    %edx,0x14(%eax)
                cachep->page_order = order;
c0107bb0:	8b 45 08             	mov    0x8(%ebp),%eax
c0107bb3:	8b 55 f0             	mov    -0x10(%ebp),%edx
c0107bb6:	89 50 20             	mov    %edx,0x20(%eax)
                if (left_over != NULL) {
c0107bb9:	83 7d 18 00          	cmpl   $0x0,0x18(%ebp)
c0107bbd:	74 34                	je     c0107bf3 <calculate_slab_order+0x101>
                    *left_over = remainder;
c0107bbf:	8b 55 e8             	mov    -0x18(%ebp),%edx
c0107bc2:	8b 45 18             	mov    0x18(%ebp),%eax
c0107bc5:	89 10                	mov    %edx,(%eax)
c0107bc7:	eb 2b                	jmp    c0107bf4 <calculate_slab_order+0x102>
//   off_slab:  the control part of slab in slab or not
//   left_over: the size of can not be used area in slab
static void
calculate_slab_order(kmem_cache_t *cachep, size_t objsize, size_t align, bool off_slab, size_t *left_over) {
    size_t order;
    for (order = 0; order <= KMALLOC_MAX_ORDER; order ++) {
c0107bc9:	83 45 f0 01          	addl   $0x1,-0x10(%ebp)
c0107bcd:	83 7d f0 0a          	cmpl   $0xa,-0x10(%ebp)
c0107bd1:	0f 86 2f ff ff ff    	jbe    c0107b06 <calculate_slab_order+0x14>
                }
                return ;
            }
        }
    }
    panic("calculate_slab_over: failed.");
c0107bd7:	c7 44 24 08 05 c8 10 	movl   $0xc010c805,0x8(%esp)
c0107bde:	c0 
c0107bdf:	c7 44 24 04 d2 00 00 	movl   $0xd2,0x4(%esp)
c0107be6:	00 
c0107be7:	c7 04 24 f6 c7 10 c0 	movl   $0xc010c7f6,(%esp)
c0107bee:	e8 bd ae ff ff       	call   c0102ab0 <__panic>
            }
            if (remainder * 8 <= (PGSIZE << order)) {
                cachep->num = num;
                cachep->page_order = order;
                if (left_over != NULL) {
                    *left_over = remainder;
c0107bf3:	90                   	nop
                return ;
            }
        }
    }
    panic("calculate_slab_over: failed.");
}
c0107bf4:	83 c4 30             	add    $0x30,%esp
c0107bf7:	5b                   	pop    %ebx
c0107bf8:	5e                   	pop    %esi
c0107bf9:	5d                   	pop    %ebp
c0107bfa:	c3                   	ret    

c0107bfb <getorder>:

// getorder - find order, should satisfy n <= minest 2^order
static inline size_t
getorder(size_t n) {
c0107bfb:	55                   	push   %ebp
c0107bfc:	89 e5                	mov    %esp,%ebp
c0107bfe:	53                   	push   %ebx
c0107bff:	83 ec 24             	sub    $0x24,%esp
    size_t order = MIN_SIZE_ORDER, order_size = (1 << order);
c0107c02:	c7 45 f0 05 00 00 00 	movl   $0x5,-0x10(%ebp)
c0107c09:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0107c0c:	ba 01 00 00 00       	mov    $0x1,%edx
c0107c11:	89 d3                	mov    %edx,%ebx
c0107c13:	89 c1                	mov    %eax,%ecx
c0107c15:	d3 e3                	shl    %cl,%ebx
c0107c17:	89 d8                	mov    %ebx,%eax
c0107c19:	89 45 f4             	mov    %eax,-0xc(%ebp)
    for (; order <= MAX_SIZE_ORDER; order ++, order_size <<= 1) {
c0107c1c:	eb 18                	jmp    c0107c36 <getorder+0x3b>
        if (n <= order_size) {
c0107c1e:	8b 45 08             	mov    0x8(%ebp),%eax
c0107c21:	3b 45 f4             	cmp    -0xc(%ebp),%eax
c0107c24:	77 09                	ja     c0107c2f <getorder+0x34>
            return order;
c0107c26:	8b 45 f0             	mov    -0x10(%ebp),%eax
        }
    }
    panic("getorder failed. %d\n", n);
}
c0107c29:	83 c4 24             	add    $0x24,%esp
c0107c2c:	5b                   	pop    %ebx
c0107c2d:	5d                   	pop    %ebp
c0107c2e:	c3                   	ret    

// getorder - find order, should satisfy n <= minest 2^order
static inline size_t
getorder(size_t n) {
    size_t order = MIN_SIZE_ORDER, order_size = (1 << order);
    for (; order <= MAX_SIZE_ORDER; order ++, order_size <<= 1) {
c0107c2f:	83 45 f0 01          	addl   $0x1,-0x10(%ebp)
c0107c33:	d1 65 f4             	shll   -0xc(%ebp)
c0107c36:	83 7d f0 11          	cmpl   $0x11,-0x10(%ebp)
c0107c3a:	76 e2                	jbe    c0107c1e <getorder+0x23>
        if (n <= order_size) {
            return order;
        }
    }
    panic("getorder failed. %d\n", n);
c0107c3c:	8b 45 08             	mov    0x8(%ebp),%eax
c0107c3f:	89 44 24 0c          	mov    %eax,0xc(%esp)
c0107c43:	c7 44 24 08 22 c8 10 	movl   $0xc010c822,0x8(%esp)
c0107c4a:	c0 
c0107c4b:	c7 44 24 04 de 00 00 	movl   $0xde,0x4(%esp)
c0107c52:	00 
c0107c53:	c7 04 24 f6 c7 10 c0 	movl   $0xc010c7f6,(%esp)
c0107c5a:	e8 51 ae ff ff       	call   c0102ab0 <__panic>

c0107c5f <init_kmem_cache>:
}

// init_kmem_cache - initial a slab_cache cachep according to the obj with the size = objsize
static void
init_kmem_cache(kmem_cache_t *cachep, size_t objsize, size_t align) {
c0107c5f:	55                   	push   %ebp
c0107c60:	89 e5                	mov    %esp,%ebp
c0107c62:	83 ec 48             	sub    $0x48,%esp
    list_init(&(cachep->slabs_full));
c0107c65:	8b 45 08             	mov    0x8(%ebp),%eax
c0107c68:	89 45 f0             	mov    %eax,-0x10(%ebp)
 * list_init - initialize a new entry
 * @elm:        new entry to be initialized
 * */
static inline void
list_init(list_entry_t *elm) {
    elm->prev = elm->next = elm;
c0107c6b:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0107c6e:	8b 55 f0             	mov    -0x10(%ebp),%edx
c0107c71:	89 50 04             	mov    %edx,0x4(%eax)
c0107c74:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0107c77:	8b 50 04             	mov    0x4(%eax),%edx
c0107c7a:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0107c7d:	89 10                	mov    %edx,(%eax)
    list_init(&(cachep->slabs_notfull));
c0107c7f:	8b 45 08             	mov    0x8(%ebp),%eax
c0107c82:	83 c0 08             	add    $0x8,%eax
c0107c85:	89 45 f4             	mov    %eax,-0xc(%ebp)
c0107c88:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0107c8b:	8b 55 f4             	mov    -0xc(%ebp),%edx
c0107c8e:	89 50 04             	mov    %edx,0x4(%eax)
c0107c91:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0107c94:	8b 50 04             	mov    0x4(%eax),%edx
c0107c97:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0107c9a:	89 10                	mov    %edx,(%eax)

    objsize = ROUNDUP(objsize, align);
c0107c9c:	8b 45 10             	mov    0x10(%ebp),%eax
c0107c9f:	89 45 e8             	mov    %eax,-0x18(%ebp)
c0107ca2:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0107ca5:	8b 55 0c             	mov    0xc(%ebp),%edx
c0107ca8:	8d 04 02             	lea    (%edx,%eax,1),%eax
c0107cab:	83 e8 01             	sub    $0x1,%eax
c0107cae:	89 45 ec             	mov    %eax,-0x14(%ebp)
c0107cb1:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0107cb4:	ba 00 00 00 00       	mov    $0x0,%edx
c0107cb9:	f7 75 e8             	divl   -0x18(%ebp)
c0107cbc:	89 d0                	mov    %edx,%eax
c0107cbe:	8b 55 ec             	mov    -0x14(%ebp),%edx
c0107cc1:	89 d1                	mov    %edx,%ecx
c0107cc3:	29 c1                	sub    %eax,%ecx
c0107cc5:	89 c8                	mov    %ecx,%eax
c0107cc7:	89 45 0c             	mov    %eax,0xc(%ebp)
    cachep->objsize = objsize;
c0107cca:	8b 45 08             	mov    0x8(%ebp),%eax
c0107ccd:	8b 55 0c             	mov    0xc(%ebp),%edx
c0107cd0:	89 50 10             	mov    %edx,0x10(%eax)
    cachep->off_slab = (objsize >= (PGSIZE >> 3));
c0107cd3:	81 7d 0c ff 01 00 00 	cmpl   $0x1ff,0xc(%ebp)
c0107cda:	0f 97 c0             	seta   %al
c0107cdd:	0f b6 d0             	movzbl %al,%edx
c0107ce0:	8b 45 08             	mov    0x8(%ebp),%eax
c0107ce3:	89 50 1c             	mov    %edx,0x1c(%eax)

    size_t left_over;
    calculate_slab_order(cachep, objsize, align, cachep->off_slab, &left_over);
c0107ce6:	8b 45 08             	mov    0x8(%ebp),%eax
c0107ce9:	8b 40 1c             	mov    0x1c(%eax),%eax
c0107cec:	8d 55 e0             	lea    -0x20(%ebp),%edx
c0107cef:	89 54 24 10          	mov    %edx,0x10(%esp)
c0107cf3:	89 44 24 0c          	mov    %eax,0xc(%esp)
c0107cf7:	8b 45 10             	mov    0x10(%ebp),%eax
c0107cfa:	89 44 24 08          	mov    %eax,0x8(%esp)
c0107cfe:	8b 45 0c             	mov    0xc(%ebp),%eax
c0107d01:	89 44 24 04          	mov    %eax,0x4(%esp)
c0107d05:	8b 45 08             	mov    0x8(%ebp),%eax
c0107d08:	89 04 24             	mov    %eax,(%esp)
c0107d0b:	e8 e2 fd ff ff       	call   c0107af2 <calculate_slab_order>

    assert(cachep->num > 0);
c0107d10:	8b 45 08             	mov    0x8(%ebp),%eax
c0107d13:	8b 40 14             	mov    0x14(%eax),%eax
c0107d16:	85 c0                	test   %eax,%eax
c0107d18:	75 24                	jne    c0107d3e <init_kmem_cache+0xdf>
c0107d1a:	c7 44 24 0c 37 c8 10 	movl   $0xc010c837,0xc(%esp)
c0107d21:	c0 
c0107d22:	c7 44 24 08 47 c8 10 	movl   $0xc010c847,0x8(%esp)
c0107d29:	c0 
c0107d2a:	c7 44 24 04 ee 00 00 	movl   $0xee,0x4(%esp)
c0107d31:	00 
c0107d32:	c7 04 24 f6 c7 10 c0 	movl   $0xc010c7f6,(%esp)
c0107d39:	e8 72 ad ff ff       	call   c0102ab0 <__panic>

    size_t mgmt_size = slab_mgmt_size(cachep->num, align);
c0107d3e:	8b 45 08             	mov    0x8(%ebp),%eax
c0107d41:	8b 40 14             	mov    0x14(%eax),%eax
c0107d44:	8b 55 10             	mov    0x10(%ebp),%edx
c0107d47:	89 54 24 04          	mov    %edx,0x4(%esp)
c0107d4b:	89 04 24             	mov    %eax,(%esp)
c0107d4e:	e8 9b fc ff ff       	call   c01079ee <slab_mgmt_size>
c0107d53:	89 45 e4             	mov    %eax,-0x1c(%ebp)

    if (cachep->off_slab && left_over >= mgmt_size) {
c0107d56:	8b 45 08             	mov    0x8(%ebp),%eax
c0107d59:	8b 40 1c             	mov    0x1c(%eax),%eax
c0107d5c:	85 c0                	test   %eax,%eax
c0107d5e:	74 12                	je     c0107d72 <init_kmem_cache+0x113>
c0107d60:	8b 45 e0             	mov    -0x20(%ebp),%eax
c0107d63:	3b 45 e4             	cmp    -0x1c(%ebp),%eax
c0107d66:	72 0a                	jb     c0107d72 <init_kmem_cache+0x113>
        cachep->off_slab = 0;
c0107d68:	8b 45 08             	mov    0x8(%ebp),%eax
c0107d6b:	c7 40 1c 00 00 00 00 	movl   $0x0,0x1c(%eax)
    }

    if (cachep->off_slab) {
c0107d72:	8b 45 08             	mov    0x8(%ebp),%eax
c0107d75:	8b 40 1c             	mov    0x1c(%eax),%eax
c0107d78:	85 c0                	test   %eax,%eax
c0107d7a:	74 34                	je     c0107db0 <init_kmem_cache+0x151>
        cachep->offset = 0;
c0107d7c:	8b 45 08             	mov    0x8(%ebp),%eax
c0107d7f:	c7 40 18 00 00 00 00 	movl   $0x0,0x18(%eax)
        cachep->slab_cachep = slab_cache + (getorder(mgmt_size) - MIN_SIZE_ORDER);
c0107d86:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0107d89:	89 04 24             	mov    %eax,(%esp)
c0107d8c:	e8 6a fe ff ff       	call   c0107bfb <getorder>
c0107d91:	89 c2                	mov    %eax,%edx
c0107d93:	89 d0                	mov    %edx,%eax
c0107d95:	c1 e0 02             	shl    $0x2,%eax
c0107d98:	01 d0                	add    %edx,%eax
c0107d9a:	c1 e0 03             	shl    $0x3,%eax
c0107d9d:	2d c8 00 00 00       	sub    $0xc8,%eax
c0107da2:	8d 90 a0 8a 12 c0    	lea    -0x3fed7560(%eax),%edx
c0107da8:	8b 45 08             	mov    0x8(%ebp),%eax
c0107dab:	89 50 24             	mov    %edx,0x24(%eax)
c0107dae:	eb 09                	jmp    c0107db9 <init_kmem_cache+0x15a>
    }
    else {
        cachep->offset = mgmt_size;
c0107db0:	8b 45 08             	mov    0x8(%ebp),%eax
c0107db3:	8b 55 e4             	mov    -0x1c(%ebp),%edx
c0107db6:	89 50 18             	mov    %edx,0x18(%eax)
    }
}
c0107db9:	c9                   	leave  
c0107dba:	c3                   	ret    

c0107dbb <kmem_cache_slabmgmt>:
    ((kmem_bufctl_t*)(((slab_t *)(slabp)) + 1))

// kmem_cache_slabmgmt - get the address of a slab according to page
//                     - and initialize the slab according to cachep
static slab_t *
kmem_cache_slabmgmt(kmem_cache_t *cachep, struct Page *page) {
c0107dbb:	55                   	push   %ebp
c0107dbc:	89 e5                	mov    %esp,%ebp
c0107dbe:	83 ec 28             	sub    $0x28,%esp
    void *objp = page2kva(page);
c0107dc1:	8b 45 0c             	mov    0xc(%ebp),%eax
c0107dc4:	89 04 24             	mov    %eax,(%esp)
c0107dc7:	e8 52 fa ff ff       	call   c010781e <page2kva>
c0107dcc:	89 45 f0             	mov    %eax,-0x10(%ebp)
    slab_t *slabp;
    if (cachep->off_slab) {
c0107dcf:	8b 45 08             	mov    0x8(%ebp),%eax
c0107dd2:	8b 40 1c             	mov    0x1c(%eax),%eax
c0107dd5:	85 c0                	test   %eax,%eax
c0107dd7:	74 1e                	je     c0107df7 <kmem_cache_slabmgmt+0x3c>
        if ((slabp = kmem_cache_alloc(cachep->slab_cachep)) == NULL) {
c0107dd9:	8b 45 08             	mov    0x8(%ebp),%eax
c0107ddc:	8b 40 24             	mov    0x24(%eax),%eax
c0107ddf:	89 04 24             	mov    %eax,(%esp)
c0107de2:	e8 c8 02 00 00       	call   c01080af <kmem_cache_alloc>
c0107de7:	89 45 f4             	mov    %eax,-0xc(%ebp)
c0107dea:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c0107dee:	75 15                	jne    c0107e05 <kmem_cache_slabmgmt+0x4a>
            return NULL;
c0107df0:	b8 00 00 00 00       	mov    $0x0,%eax
c0107df5:	eb 38                	jmp    c0107e2f <kmem_cache_slabmgmt+0x74>
        }
    }
    else {
        slabp = page2kva(page);
c0107df7:	8b 45 0c             	mov    0xc(%ebp),%eax
c0107dfa:	89 04 24             	mov    %eax,(%esp)
c0107dfd:	e8 1c fa ff ff       	call   c010781e <page2kva>
c0107e02:	89 45 f4             	mov    %eax,-0xc(%ebp)
    }
    slabp->inuse = 0;
c0107e05:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0107e08:	c7 40 0c 00 00 00 00 	movl   $0x0,0xc(%eax)
    slabp->offset = cachep->offset;
c0107e0f:	8b 45 08             	mov    0x8(%ebp),%eax
c0107e12:	8b 50 18             	mov    0x18(%eax),%edx
c0107e15:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0107e18:	89 50 10             	mov    %edx,0x10(%eax)
    slabp->s_mem = objp + cachep->offset;
c0107e1b:	8b 45 08             	mov    0x8(%ebp),%eax
c0107e1e:	8b 40 18             	mov    0x18(%eax),%eax
c0107e21:	89 c2                	mov    %eax,%edx
c0107e23:	03 55 f0             	add    -0x10(%ebp),%edx
c0107e26:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0107e29:	89 50 08             	mov    %edx,0x8(%eax)
    return slabp;
c0107e2c:	8b 45 f4             	mov    -0xc(%ebp),%eax
}
c0107e2f:	c9                   	leave  
c0107e30:	c3                   	ret    

c0107e31 <kmem_cache_grow>:
    } while (0)

// kmem_cache_grow - allocate a new slab by calling alloc_pages
//                 - set control area in the new slab
static bool
kmem_cache_grow(kmem_cache_t *cachep) {
c0107e31:	55                   	push   %ebp
c0107e32:	89 e5                	mov    %esp,%ebp
c0107e34:	53                   	push   %ebx
c0107e35:	83 ec 64             	sub    $0x64,%esp
    struct Page *page = alloc_pages(1 << cachep->page_order);
c0107e38:	8b 45 08             	mov    0x8(%ebp),%eax
c0107e3b:	8b 40 20             	mov    0x20(%eax),%eax
c0107e3e:	ba 01 00 00 00       	mov    $0x1,%edx
c0107e43:	89 d3                	mov    %edx,%ebx
c0107e45:	89 c1                	mov    %eax,%ecx
c0107e47:	d3 e3                	shl    %cl,%ebx
c0107e49:	89 d8                	mov    %ebx,%eax
c0107e4b:	89 04 24             	mov    %eax,(%esp)
c0107e4e:	e8 7b e1 ff ff       	call   c0105fce <alloc_pages>
c0107e53:	89 45 b0             	mov    %eax,-0x50(%ebp)
    if (page == NULL) {
c0107e56:	83 7d b0 00          	cmpl   $0x0,-0x50(%ebp)
c0107e5a:	0f 84 70 01 00 00    	je     c0107fd0 <kmem_cache_grow+0x19f>
        goto failed;
    }

    slab_t *slabp;
    if ((slabp = kmem_cache_slabmgmt(cachep, page)) == NULL) {
c0107e60:	8b 45 b0             	mov    -0x50(%ebp),%eax
c0107e63:	89 44 24 04          	mov    %eax,0x4(%esp)
c0107e67:	8b 45 08             	mov    0x8(%ebp),%eax
c0107e6a:	89 04 24             	mov    %eax,(%esp)
c0107e6d:	e8 49 ff ff ff       	call   c0107dbb <kmem_cache_slabmgmt>
c0107e72:	89 45 b4             	mov    %eax,-0x4c(%ebp)
c0107e75:	83 7d b4 00          	cmpl   $0x0,-0x4c(%ebp)
c0107e79:	0f 84 2c 01 00 00    	je     c0107fab <kmem_cache_grow+0x17a>
        goto oops;
    }

    size_t order_size = (1 << cachep->page_order);
c0107e7f:	8b 45 08             	mov    0x8(%ebp),%eax
c0107e82:	8b 40 20             	mov    0x20(%eax),%eax
c0107e85:	ba 01 00 00 00       	mov    $0x1,%edx
c0107e8a:	89 d3                	mov    %edx,%ebx
c0107e8c:	89 c1                	mov    %eax,%ecx
c0107e8e:	d3 e3                	shl    %cl,%ebx
c0107e90:	89 d8                	mov    %ebx,%eax
c0107e92:	89 45 b8             	mov    %eax,-0x48(%ebp)
    do {
        //setup this page in the free list (see memlayout.h: struct page)???
        SET_PAGE_CACHE(page, cachep);
c0107e95:	8b 45 b0             	mov    -0x50(%ebp),%eax
c0107e98:	89 45 c4             	mov    %eax,-0x3c(%ebp)
c0107e9b:	8b 45 c4             	mov    -0x3c(%ebp),%eax
c0107e9e:	83 c0 14             	add    $0x14,%eax
c0107ea1:	89 45 c8             	mov    %eax,-0x38(%ebp)
c0107ea4:	8b 45 c8             	mov    -0x38(%ebp),%eax
c0107ea7:	8b 55 08             	mov    0x8(%ebp),%edx
c0107eaa:	89 10                	mov    %edx,(%eax)
        SET_PAGE_SLAB(page, slabp);
c0107eac:	8b 45 b0             	mov    -0x50(%ebp),%eax
c0107eaf:	89 45 cc             	mov    %eax,-0x34(%ebp)
c0107eb2:	8b 45 cc             	mov    -0x34(%ebp),%eax
c0107eb5:	83 c0 10             	add    $0x10,%eax
c0107eb8:	89 45 d0             	mov    %eax,-0x30(%ebp)
c0107ebb:	8b 45 d0             	mov    -0x30(%ebp),%eax
c0107ebe:	8b 55 b4             	mov    -0x4c(%ebp),%edx
c0107ec1:	89 10                	mov    %edx,(%eax)
	//this page is used for slab
        SetPageSlab(page);
c0107ec3:	8b 45 b0             	mov    -0x50(%ebp),%eax
c0107ec6:	83 c0 04             	add    $0x4,%eax
c0107ec9:	c7 45 d8 02 00 00 00 	movl   $0x2,-0x28(%ebp)
c0107ed0:	89 45 d4             	mov    %eax,-0x2c(%ebp)
c0107ed3:	8b 45 d4             	mov    -0x2c(%ebp),%eax
c0107ed6:	8b 55 d8             	mov    -0x28(%ebp),%edx
c0107ed9:	0f ab 10             	bts    %edx,(%eax)
        page ++;
c0107edc:	83 45 b0 18          	addl   $0x18,-0x50(%ebp)
    } while (-- order_size);
c0107ee0:	83 6d b8 01          	subl   $0x1,-0x48(%ebp)
c0107ee4:	83 7d b8 00          	cmpl   $0x0,-0x48(%ebp)
c0107ee8:	75 ab                	jne    c0107e95 <kmem_cache_grow+0x64>

    int i;
    for (i = 0; i < cachep->num; i ++) {
c0107eea:	c7 45 bc 00 00 00 00 	movl   $0x0,-0x44(%ebp)
c0107ef1:	eb 1b                	jmp    c0107f0e <kmem_cache_grow+0xdd>
        slab_bufctl(slabp)[i] = i + 1;
c0107ef3:	8b 45 b4             	mov    -0x4c(%ebp),%eax
c0107ef6:	8b 55 bc             	mov    -0x44(%ebp),%edx
c0107ef9:	83 c2 06             	add    $0x6,%edx
c0107efc:	c1 e2 02             	shl    $0x2,%edx
c0107eff:	8d 14 10             	lea    (%eax,%edx,1),%edx
c0107f02:	8b 45 bc             	mov    -0x44(%ebp),%eax
c0107f05:	83 c0 01             	add    $0x1,%eax
c0107f08:	89 02                	mov    %eax,(%edx)
        SetPageSlab(page);
        page ++;
    } while (-- order_size);

    int i;
    for (i = 0; i < cachep->num; i ++) {
c0107f0a:	83 45 bc 01          	addl   $0x1,-0x44(%ebp)
c0107f0e:	8b 55 bc             	mov    -0x44(%ebp),%edx
c0107f11:	8b 45 08             	mov    0x8(%ebp),%eax
c0107f14:	8b 40 14             	mov    0x14(%eax),%eax
c0107f17:	39 c2                	cmp    %eax,%edx
c0107f19:	72 d8                	jb     c0107ef3 <kmem_cache_grow+0xc2>
        slab_bufctl(slabp)[i] = i + 1;
    }
    slab_bufctl(slabp)[cachep->num - 1] = BUFCTL_END;
c0107f1b:	8b 55 b4             	mov    -0x4c(%ebp),%edx
c0107f1e:	8b 45 08             	mov    0x8(%ebp),%eax
c0107f21:	8b 40 14             	mov    0x14(%eax),%eax
c0107f24:	83 c0 05             	add    $0x5,%eax
c0107f27:	c1 e0 02             	shl    $0x2,%eax
c0107f2a:	8d 04 02             	lea    (%edx,%eax,1),%eax
c0107f2d:	c7 00 ff ff ff ff    	movl   $0xffffffff,(%eax)
    slabp->free = 0;
c0107f33:	8b 45 b4             	mov    -0x4c(%ebp),%eax
c0107f36:	c7 40 14 00 00 00 00 	movl   $0x0,0x14(%eax)

    bool intr_flag;
    local_intr_save(intr_flag);
c0107f3d:	e8 1e f8 ff ff       	call   c0107760 <__intr_save>
c0107f42:	89 45 c0             	mov    %eax,-0x40(%ebp)
    {
        list_add(&(cachep->slabs_notfull), &(slabp->slab_link));
c0107f45:	8b 45 b4             	mov    -0x4c(%ebp),%eax
c0107f48:	8b 55 08             	mov    0x8(%ebp),%edx
c0107f4b:	83 c2 08             	add    $0x8,%edx
c0107f4e:	89 55 e0             	mov    %edx,-0x20(%ebp)
c0107f51:	89 45 dc             	mov    %eax,-0x24(%ebp)
c0107f54:	8b 45 e0             	mov    -0x20(%ebp),%eax
c0107f57:	89 45 e8             	mov    %eax,-0x18(%ebp)
c0107f5a:	8b 45 dc             	mov    -0x24(%ebp),%eax
c0107f5d:	89 45 e4             	mov    %eax,-0x1c(%ebp)
 * Insert the new element @elm *after* the element @listelm which
 * is already in the list.
 * */
static inline void
list_add_after(list_entry_t *listelm, list_entry_t *elm) {
    __list_add(elm, listelm, listelm->next);
c0107f60:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0107f63:	8b 40 04             	mov    0x4(%eax),%eax
c0107f66:	8b 55 e4             	mov    -0x1c(%ebp),%edx
c0107f69:	89 55 f4             	mov    %edx,-0xc(%ebp)
c0107f6c:	8b 55 e8             	mov    -0x18(%ebp),%edx
c0107f6f:	89 55 f0             	mov    %edx,-0x10(%ebp)
c0107f72:	89 45 ec             	mov    %eax,-0x14(%ebp)
 * This is only for internal list manipulation where we know
 * the prev/next entries already!
 * */
static inline void
__list_add(list_entry_t *elm, list_entry_t *prev, list_entry_t *next) {
    prev->next = next->prev = elm;
c0107f75:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0107f78:	8b 55 f4             	mov    -0xc(%ebp),%edx
c0107f7b:	89 10                	mov    %edx,(%eax)
c0107f7d:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0107f80:	8b 10                	mov    (%eax),%edx
c0107f82:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0107f85:	89 50 04             	mov    %edx,0x4(%eax)
    elm->next = next;
c0107f88:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0107f8b:	8b 55 ec             	mov    -0x14(%ebp),%edx
c0107f8e:	89 50 04             	mov    %edx,0x4(%eax)
    elm->prev = prev;
c0107f91:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0107f94:	8b 55 f0             	mov    -0x10(%ebp),%edx
c0107f97:	89 10                	mov    %edx,(%eax)
    }
    local_intr_restore(intr_flag);
c0107f99:	8b 45 c0             	mov    -0x40(%ebp),%eax
c0107f9c:	89 04 24             	mov    %eax,(%esp)
c0107f9f:	e8 e6 f7 ff ff       	call   c010778a <__intr_restore>
    return 1;
c0107fa4:	b8 01 00 00 00       	mov    $0x1,%eax
c0107fa9:	eb 2b                	jmp    c0107fd6 <kmem_cache_grow+0x1a5>
        goto failed;
    }

    slab_t *slabp;
    if ((slabp = kmem_cache_slabmgmt(cachep, page)) == NULL) {
        goto oops;
c0107fab:	90                   	nop
    }
    local_intr_restore(intr_flag);
    return 1;

oops:
    free_pages(page, 1 << cachep->page_order);
c0107fac:	8b 45 08             	mov    0x8(%ebp),%eax
c0107faf:	8b 40 20             	mov    0x20(%eax),%eax
c0107fb2:	ba 01 00 00 00       	mov    $0x1,%edx
c0107fb7:	89 d3                	mov    %edx,%ebx
c0107fb9:	89 c1                	mov    %eax,%ecx
c0107fbb:	d3 e3                	shl    %cl,%ebx
c0107fbd:	89 d8                	mov    %ebx,%eax
c0107fbf:	89 44 24 04          	mov    %eax,0x4(%esp)
c0107fc3:	8b 45 b0             	mov    -0x50(%ebp),%eax
c0107fc6:	89 04 24             	mov    %eax,(%esp)
c0107fc9:	e8 31 e0 ff ff       	call   c0105fff <free_pages>
c0107fce:	eb 01                	jmp    c0107fd1 <kmem_cache_grow+0x1a0>
//                 - set control area in the new slab
static bool
kmem_cache_grow(kmem_cache_t *cachep) {
    struct Page *page = alloc_pages(1 << cachep->page_order);
    if (page == NULL) {
        goto failed;
c0107fd0:	90                   	nop
    return 1;

oops:
    free_pages(page, 1 << cachep->page_order);
failed:
    return 0;
c0107fd1:	b8 00 00 00 00       	mov    $0x0,%eax
}
c0107fd6:	83 c4 64             	add    $0x64,%esp
c0107fd9:	5b                   	pop    %ebx
c0107fda:	5d                   	pop    %ebp
c0107fdb:	c3                   	ret    

c0107fdc <kmem_cache_alloc_one>:

// kmem_cache_alloc_one - allocate a obj in a slab
static void * 
kmem_cache_alloc_one(kmem_cache_t *cachep, slab_t *slabp) {
c0107fdc:	55                   	push   %ebp
c0107fdd:	89 e5                	mov    %esp,%ebp
c0107fdf:	83 ec 30             	sub    $0x30,%esp
    slabp->inuse ++;
c0107fe2:	8b 45 0c             	mov    0xc(%ebp),%eax
c0107fe5:	8b 40 0c             	mov    0xc(%eax),%eax
c0107fe8:	8d 50 01             	lea    0x1(%eax),%edx
c0107feb:	8b 45 0c             	mov    0xc(%ebp),%eax
c0107fee:	89 50 0c             	mov    %edx,0xc(%eax)
    void *objp = slabp->s_mem + slabp->free * cachep->objsize;
c0107ff1:	8b 45 0c             	mov    0xc(%ebp),%eax
c0107ff4:	8b 50 08             	mov    0x8(%eax),%edx
c0107ff7:	8b 45 0c             	mov    0xc(%ebp),%eax
c0107ffa:	8b 48 14             	mov    0x14(%eax),%ecx
c0107ffd:	8b 45 08             	mov    0x8(%ebp),%eax
c0108000:	8b 40 10             	mov    0x10(%eax),%eax
c0108003:	0f af c1             	imul   %ecx,%eax
c0108006:	8d 04 02             	lea    (%edx,%eax,1),%eax
c0108009:	89 45 d4             	mov    %eax,-0x2c(%ebp)
    slabp->free = slab_bufctl(slabp)[slabp->free];
c010800c:	8b 55 0c             	mov    0xc(%ebp),%edx
c010800f:	8b 45 0c             	mov    0xc(%ebp),%eax
c0108012:	8b 40 14             	mov    0x14(%eax),%eax
c0108015:	83 c0 06             	add    $0x6,%eax
c0108018:	c1 e0 02             	shl    $0x2,%eax
c010801b:	8d 04 02             	lea    (%edx,%eax,1),%eax
c010801e:	8b 10                	mov    (%eax),%edx
c0108020:	8b 45 0c             	mov    0xc(%ebp),%eax
c0108023:	89 50 14             	mov    %edx,0x14(%eax)

    if (slabp->free == BUFCTL_END) {
c0108026:	8b 45 0c             	mov    0xc(%ebp),%eax
c0108029:	8b 40 14             	mov    0x14(%eax),%eax
c010802c:	83 f8 ff             	cmp    $0xffffffff,%eax
c010802f:	75 79                	jne    c01080aa <kmem_cache_alloc_one+0xce>
        list_del(&(slabp->slab_link));
c0108031:	8b 45 0c             	mov    0xc(%ebp),%eax
c0108034:	89 45 d8             	mov    %eax,-0x28(%ebp)
 * Note: list_empty() on @listelm does not return true after this, the entry is
 * in an undefined state.
 * */
static inline void
list_del(list_entry_t *listelm) {
    __list_del(listelm->prev, listelm->next);
c0108037:	8b 45 d8             	mov    -0x28(%ebp),%eax
c010803a:	8b 40 04             	mov    0x4(%eax),%eax
c010803d:	8b 55 d8             	mov    -0x28(%ebp),%edx
c0108040:	8b 12                	mov    (%edx),%edx
c0108042:	89 55 e0             	mov    %edx,-0x20(%ebp)
c0108045:	89 45 dc             	mov    %eax,-0x24(%ebp)
 * This is only for internal list manipulation where we know
 * the prev/next entries already!
 * */
static inline void
__list_del(list_entry_t *prev, list_entry_t *next) {
    prev->next = next;
c0108048:	8b 45 e0             	mov    -0x20(%ebp),%eax
c010804b:	8b 55 dc             	mov    -0x24(%ebp),%edx
c010804e:	89 50 04             	mov    %edx,0x4(%eax)
    next->prev = prev;
c0108051:	8b 45 dc             	mov    -0x24(%ebp),%eax
c0108054:	8b 55 e0             	mov    -0x20(%ebp),%edx
c0108057:	89 10                	mov    %edx,(%eax)
        list_add(&(cachep->slabs_full), &(slabp->slab_link));
c0108059:	8b 45 0c             	mov    0xc(%ebp),%eax
c010805c:	8b 55 08             	mov    0x8(%ebp),%edx
c010805f:	89 55 e8             	mov    %edx,-0x18(%ebp)
c0108062:	89 45 e4             	mov    %eax,-0x1c(%ebp)
c0108065:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0108068:	89 45 f0             	mov    %eax,-0x10(%ebp)
c010806b:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c010806e:	89 45 ec             	mov    %eax,-0x14(%ebp)
 * Insert the new element @elm *after* the element @listelm which
 * is already in the list.
 * */
static inline void
list_add_after(list_entry_t *listelm, list_entry_t *elm) {
    __list_add(elm, listelm, listelm->next);
c0108071:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0108074:	8b 40 04             	mov    0x4(%eax),%eax
c0108077:	8b 55 ec             	mov    -0x14(%ebp),%edx
c010807a:	89 55 fc             	mov    %edx,-0x4(%ebp)
c010807d:	8b 55 f0             	mov    -0x10(%ebp),%edx
c0108080:	89 55 f8             	mov    %edx,-0x8(%ebp)
c0108083:	89 45 f4             	mov    %eax,-0xc(%ebp)
 * This is only for internal list manipulation where we know
 * the prev/next entries already!
 * */
static inline void
__list_add(list_entry_t *elm, list_entry_t *prev, list_entry_t *next) {
    prev->next = next->prev = elm;
c0108086:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0108089:	8b 55 fc             	mov    -0x4(%ebp),%edx
c010808c:	89 10                	mov    %edx,(%eax)
c010808e:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0108091:	8b 10                	mov    (%eax),%edx
c0108093:	8b 45 f8             	mov    -0x8(%ebp),%eax
c0108096:	89 50 04             	mov    %edx,0x4(%eax)
    elm->next = next;
c0108099:	8b 45 fc             	mov    -0x4(%ebp),%eax
c010809c:	8b 55 f4             	mov    -0xc(%ebp),%edx
c010809f:	89 50 04             	mov    %edx,0x4(%eax)
    elm->prev = prev;
c01080a2:	8b 45 fc             	mov    -0x4(%ebp),%eax
c01080a5:	8b 55 f8             	mov    -0x8(%ebp),%edx
c01080a8:	89 10                	mov    %edx,(%eax)
    }
    return objp;
c01080aa:	8b 45 d4             	mov    -0x2c(%ebp),%eax
}
c01080ad:	c9                   	leave  
c01080ae:	c3                   	ret    

c01080af <kmem_cache_alloc>:

// kmem_cache_alloc - call kmem_cache_alloc_one function to allocate a obj
//                  - if no free obj, try to allocate a slab
static void *
kmem_cache_alloc(kmem_cache_t *cachep) {
c01080af:	55                   	push   %ebp
c01080b0:	89 e5                	mov    %esp,%ebp
c01080b2:	83 ec 38             	sub    $0x38,%esp
c01080b5:	eb 01                	jmp    c01080b8 <kmem_cache_alloc+0x9>

alloc_new_slab:
    local_intr_restore(intr_flag);

    if (kmem_cache_grow(cachep)) {
        goto try_again;
c01080b7:	90                   	nop
kmem_cache_alloc(kmem_cache_t *cachep) {
    void *objp;
    bool intr_flag;

try_again:
    local_intr_save(intr_flag);
c01080b8:	e8 a3 f6 ff ff       	call   c0107760 <__intr_save>
c01080bd:	89 45 e8             	mov    %eax,-0x18(%ebp)
    if (list_empty(&(cachep->slabs_notfull))) {
c01080c0:	8b 45 08             	mov    0x8(%ebp),%eax
c01080c3:	83 c0 08             	add    $0x8,%eax
c01080c6:	89 45 f0             	mov    %eax,-0x10(%ebp)
 * list_empty - tests whether a list is empty
 * @list:       the list to test.
 * */
static inline bool
list_empty(list_entry_t *list) {
    return list->next == list;
c01080c9:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01080cc:	8b 40 04             	mov    0x4(%eax),%eax
c01080cf:	39 45 f0             	cmp    %eax,-0x10(%ebp)
c01080d2:	0f 94 c0             	sete   %al
c01080d5:	0f b6 c0             	movzbl %al,%eax
c01080d8:	85 c0                	test   %eax,%eax
c01080da:	75 37                	jne    c0108113 <kmem_cache_alloc+0x64>
        goto alloc_new_slab;
    }
    slab_t *slabp = le2slab(list_next(&(cachep->slabs_notfull)), slab_link);
c01080dc:	8b 45 08             	mov    0x8(%ebp),%eax
c01080df:	83 c0 08             	add    $0x8,%eax
c01080e2:	89 45 f4             	mov    %eax,-0xc(%ebp)
 * list_next - get the next entry
 * @listelm:    the list head
 **/
static list_entry_t *
list_next(list_entry_t *listelm) {
    return listelm->next;
c01080e5:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01080e8:	8b 40 04             	mov    0x4(%eax),%eax
c01080eb:	89 45 ec             	mov    %eax,-0x14(%ebp)
    objp = kmem_cache_alloc_one(cachep, slabp);
c01080ee:	8b 45 ec             	mov    -0x14(%ebp),%eax
c01080f1:	89 44 24 04          	mov    %eax,0x4(%esp)
c01080f5:	8b 45 08             	mov    0x8(%ebp),%eax
c01080f8:	89 04 24             	mov    %eax,(%esp)
c01080fb:	e8 dc fe ff ff       	call   c0107fdc <kmem_cache_alloc_one>
c0108100:	89 45 e4             	mov    %eax,-0x1c(%ebp)
    local_intr_restore(intr_flag);
c0108103:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0108106:	89 04 24             	mov    %eax,(%esp)
c0108109:	e8 7c f6 ff ff       	call   c010778a <__intr_restore>
    return objp;
c010810e:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0108111:	eb 20                	jmp    c0108133 <kmem_cache_alloc+0x84>
    bool intr_flag;

try_again:
    local_intr_save(intr_flag);
    if (list_empty(&(cachep->slabs_notfull))) {
        goto alloc_new_slab;
c0108113:	90                   	nop
    objp = kmem_cache_alloc_one(cachep, slabp);
    local_intr_restore(intr_flag);
    return objp;

alloc_new_slab:
    local_intr_restore(intr_flag);
c0108114:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0108117:	89 04 24             	mov    %eax,(%esp)
c010811a:	e8 6b f6 ff ff       	call   c010778a <__intr_restore>

    if (kmem_cache_grow(cachep)) {
c010811f:	8b 45 08             	mov    0x8(%ebp),%eax
c0108122:	89 04 24             	mov    %eax,(%esp)
c0108125:	e8 07 fd ff ff       	call   c0107e31 <kmem_cache_grow>
c010812a:	85 c0                	test   %eax,%eax
c010812c:	75 89                	jne    c01080b7 <kmem_cache_alloc+0x8>
        goto try_again;
    }
    return NULL;
c010812e:	b8 00 00 00 00       	mov    $0x0,%eax
}
c0108133:	c9                   	leave  
c0108134:	c3                   	ret    

c0108135 <kmalloc>:

// kmalloc - simple interface used by outside functions 
//         - to allocate a free memory using kmem_cache_alloc function
void *
kmalloc(size_t size) {
c0108135:	55                   	push   %ebp
c0108136:	89 e5                	mov    %esp,%ebp
c0108138:	83 ec 28             	sub    $0x28,%esp
    assert(size > 0);
c010813b:	83 7d 08 00          	cmpl   $0x0,0x8(%ebp)
c010813f:	75 24                	jne    c0108165 <kmalloc+0x30>
c0108141:	c7 44 24 0c 5c c8 10 	movl   $0xc010c85c,0xc(%esp)
c0108148:	c0 
c0108149:	c7 44 24 08 47 c8 10 	movl   $0xc010c847,0x8(%esp)
c0108150:	c0 
c0108151:	c7 44 24 04 7f 01 00 	movl   $0x17f,0x4(%esp)
c0108158:	00 
c0108159:	c7 04 24 f6 c7 10 c0 	movl   $0xc010c7f6,(%esp)
c0108160:	e8 4b a9 ff ff       	call   c0102ab0 <__panic>
    size_t order = getorder(size);
c0108165:	8b 45 08             	mov    0x8(%ebp),%eax
c0108168:	89 04 24             	mov    %eax,(%esp)
c010816b:	e8 8b fa ff ff       	call   c0107bfb <getorder>
c0108170:	89 45 f4             	mov    %eax,-0xc(%ebp)
    if (order > MAX_SIZE_ORDER) {
c0108173:	83 7d f4 11          	cmpl   $0x11,-0xc(%ebp)
c0108177:	76 07                	jbe    c0108180 <kmalloc+0x4b>
        return NULL;
c0108179:	b8 00 00 00 00       	mov    $0x0,%eax
c010817e:	eb 1f                	jmp    c010819f <kmalloc+0x6a>
    }
    return kmem_cache_alloc(slab_cache + (order - MIN_SIZE_ORDER));
c0108180:	8b 55 f4             	mov    -0xc(%ebp),%edx
c0108183:	89 d0                	mov    %edx,%eax
c0108185:	c1 e0 02             	shl    $0x2,%eax
c0108188:	01 d0                	add    %edx,%eax
c010818a:	c1 e0 03             	shl    $0x3,%eax
c010818d:	2d c8 00 00 00       	sub    $0xc8,%eax
c0108192:	05 a0 8a 12 c0       	add    $0xc0128aa0,%eax
c0108197:	89 04 24             	mov    %eax,(%esp)
c010819a:	e8 10 ff ff ff       	call   c01080af <kmem_cache_alloc>
}
c010819f:	c9                   	leave  
c01081a0:	c3                   	ret    

c01081a1 <kmem_slab_destroy>:

static void kmem_cache_free(kmem_cache_t *cachep, void *obj);

// kmem_slab_destroy - call free_pages & kmem_cache_free to free a slab 
static void
kmem_slab_destroy(kmem_cache_t *cachep, slab_t *slabp) {
c01081a1:	55                   	push   %ebp
c01081a2:	89 e5                	mov    %esp,%ebp
c01081a4:	53                   	push   %ebx
c01081a5:	83 ec 34             	sub    $0x34,%esp
    struct Page *page = kva2page(slabp->s_mem - slabp->offset);
c01081a8:	8b 45 0c             	mov    0xc(%ebp),%eax
c01081ab:	8b 50 08             	mov    0x8(%eax),%edx
c01081ae:	8b 45 0c             	mov    0xc(%ebp),%eax
c01081b1:	8b 40 10             	mov    0x10(%eax),%eax
c01081b4:	f7 d8                	neg    %eax
c01081b6:	8d 04 02             	lea    (%edx,%eax,1),%eax
c01081b9:	89 04 24             	mov    %eax,(%esp)
c01081bc:	e8 b1 f6 ff ff       	call   c0107872 <kva2page>
c01081c1:	89 45 d8             	mov    %eax,-0x28(%ebp)

    struct Page *p = page;
c01081c4:	8b 45 d8             	mov    -0x28(%ebp),%eax
c01081c7:	89 45 dc             	mov    %eax,-0x24(%ebp)
    size_t order_size = (1 << cachep->page_order);
c01081ca:	8b 45 08             	mov    0x8(%ebp),%eax
c01081cd:	8b 40 20             	mov    0x20(%eax),%eax
c01081d0:	ba 01 00 00 00       	mov    $0x1,%edx
c01081d5:	89 d3                	mov    %edx,%ebx
c01081d7:	89 c1                	mov    %eax,%ecx
c01081d9:	d3 e3                	shl    %cl,%ebx
c01081db:	89 d8                	mov    %ebx,%eax
c01081dd:	89 45 e0             	mov    %eax,-0x20(%ebp)
    do {
        assert(PageSlab(p));
c01081e0:	8b 45 dc             	mov    -0x24(%ebp),%eax
c01081e3:	83 c0 04             	add    $0x4,%eax
c01081e6:	c7 45 e8 02 00 00 00 	movl   $0x2,-0x18(%ebp)
c01081ed:	89 45 e4             	mov    %eax,-0x1c(%ebp)
 * @addr:   the address to count from
 * */
static inline bool
test_bit(int nr, volatile void *addr) {
    int oldbit;
    asm volatile ("btl %2, %1; sbbl %0,%0" : "=r" (oldbit) : "m" (*(volatile long *)addr), "Ir" (nr));
c01081f0:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c01081f3:	8b 55 e8             	mov    -0x18(%ebp),%edx
c01081f6:	0f a3 10             	bt     %edx,(%eax)
c01081f9:	19 c0                	sbb    %eax,%eax
c01081fb:	89 45 ec             	mov    %eax,-0x14(%ebp)
    return oldbit != 0;
c01081fe:	83 7d ec 00          	cmpl   $0x0,-0x14(%ebp)
c0108202:	0f 95 c0             	setne  %al
c0108205:	0f b6 c0             	movzbl %al,%eax
c0108208:	85 c0                	test   %eax,%eax
c010820a:	75 24                	jne    c0108230 <kmem_slab_destroy+0x8f>
c010820c:	c7 44 24 0c 65 c8 10 	movl   $0xc010c865,0xc(%esp)
c0108213:	c0 
c0108214:	c7 44 24 08 47 c8 10 	movl   $0xc010c847,0x8(%esp)
c010821b:	c0 
c010821c:	c7 44 24 04 91 01 00 	movl   $0x191,0x4(%esp)
c0108223:	00 
c0108224:	c7 04 24 f6 c7 10 c0 	movl   $0xc010c7f6,(%esp)
c010822b:	e8 80 a8 ff ff       	call   c0102ab0 <__panic>
        ClearPageSlab(p);
c0108230:	8b 45 dc             	mov    -0x24(%ebp),%eax
c0108233:	83 c0 04             	add    $0x4,%eax
c0108236:	c7 45 f4 02 00 00 00 	movl   $0x2,-0xc(%ebp)
c010823d:	89 45 f0             	mov    %eax,-0x10(%ebp)
 * @nr:     the bit to clear
 * @addr:   the address to start counting from
 * */
static inline void
clear_bit(int nr, volatile void *addr) {
    asm volatile ("btrl %1, %0" :"=m" (*(volatile long *)addr) : "Ir" (nr));
c0108240:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0108243:	8b 55 f4             	mov    -0xc(%ebp),%edx
c0108246:	0f b3 10             	btr    %edx,(%eax)
        p ++;
c0108249:	83 45 dc 18          	addl   $0x18,-0x24(%ebp)
    } while (-- order_size);
c010824d:	83 6d e0 01          	subl   $0x1,-0x20(%ebp)
c0108251:	83 7d e0 00          	cmpl   $0x0,-0x20(%ebp)
c0108255:	75 89                	jne    c01081e0 <kmem_slab_destroy+0x3f>

    free_pages(page, 1 << cachep->page_order);
c0108257:	8b 45 08             	mov    0x8(%ebp),%eax
c010825a:	8b 40 20             	mov    0x20(%eax),%eax
c010825d:	ba 01 00 00 00       	mov    $0x1,%edx
c0108262:	89 d3                	mov    %edx,%ebx
c0108264:	89 c1                	mov    %eax,%ecx
c0108266:	d3 e3                	shl    %cl,%ebx
c0108268:	89 d8                	mov    %ebx,%eax
c010826a:	89 44 24 04          	mov    %eax,0x4(%esp)
c010826e:	8b 45 d8             	mov    -0x28(%ebp),%eax
c0108271:	89 04 24             	mov    %eax,(%esp)
c0108274:	e8 86 dd ff ff       	call   c0105fff <free_pages>

    if (cachep->off_slab) {
c0108279:	8b 45 08             	mov    0x8(%ebp),%eax
c010827c:	8b 40 1c             	mov    0x1c(%eax),%eax
c010827f:	85 c0                	test   %eax,%eax
c0108281:	74 15                	je     c0108298 <kmem_slab_destroy+0xf7>
        kmem_cache_free(cachep->slab_cachep, slabp);
c0108283:	8b 45 08             	mov    0x8(%ebp),%eax
c0108286:	8b 40 24             	mov    0x24(%eax),%eax
c0108289:	8b 55 0c             	mov    0xc(%ebp),%edx
c010828c:	89 54 24 04          	mov    %edx,0x4(%esp)
c0108290:	89 04 24             	mov    %eax,(%esp)
c0108293:	e8 38 01 00 00       	call   c01083d0 <kmem_cache_free>
    }
}
c0108298:	83 c4 34             	add    $0x34,%esp
c010829b:	5b                   	pop    %ebx
c010829c:	5d                   	pop    %ebp
c010829d:	c3                   	ret    

c010829e <kmem_cache_free_one>:

// kmem_cache_free_one - free an obj in a slab
//                     - if slab->inuse==0, then free the slab
static void
kmem_cache_free_one(kmem_cache_t *cachep, slab_t *slabp, void *objp) {
c010829e:	55                   	push   %ebp
c010829f:	89 e5                	mov    %esp,%ebp
c01082a1:	83 ec 68             	sub    $0x68,%esp
    //should not use divide operator ???
    size_t objnr = (objp - slabp->s_mem) / cachep->objsize;
c01082a4:	8b 55 10             	mov    0x10(%ebp),%edx
c01082a7:	8b 45 0c             	mov    0xc(%ebp),%eax
c01082aa:	8b 40 08             	mov    0x8(%eax),%eax
c01082ad:	89 d1                	mov    %edx,%ecx
c01082af:	29 c1                	sub    %eax,%ecx
c01082b1:	89 c8                	mov    %ecx,%eax
c01082b3:	8b 55 08             	mov    0x8(%ebp),%edx
c01082b6:	8b 52 10             	mov    0x10(%edx),%edx
c01082b9:	89 55 b4             	mov    %edx,-0x4c(%ebp)
c01082bc:	ba 00 00 00 00       	mov    $0x0,%edx
c01082c1:	f7 75 b4             	divl   -0x4c(%ebp)
c01082c4:	89 45 c0             	mov    %eax,-0x40(%ebp)
    slab_bufctl(slabp)[objnr] = slabp->free;
c01082c7:	8b 45 0c             	mov    0xc(%ebp),%eax
c01082ca:	8b 55 c0             	mov    -0x40(%ebp),%edx
c01082cd:	83 c2 06             	add    $0x6,%edx
c01082d0:	c1 e2 02             	shl    $0x2,%edx
c01082d3:	8d 14 10             	lea    (%eax,%edx,1),%edx
c01082d6:	8b 45 0c             	mov    0xc(%ebp),%eax
c01082d9:	8b 40 14             	mov    0x14(%eax),%eax
c01082dc:	89 02                	mov    %eax,(%edx)
    slabp->free = objnr;
c01082de:	8b 45 0c             	mov    0xc(%ebp),%eax
c01082e1:	8b 55 c0             	mov    -0x40(%ebp),%edx
c01082e4:	89 50 14             	mov    %edx,0x14(%eax)

    slabp->inuse --;
c01082e7:	8b 45 0c             	mov    0xc(%ebp),%eax
c01082ea:	8b 40 0c             	mov    0xc(%eax),%eax
c01082ed:	8d 50 ff             	lea    -0x1(%eax),%edx
c01082f0:	8b 45 0c             	mov    0xc(%ebp),%eax
c01082f3:	89 50 0c             	mov    %edx,0xc(%eax)

    if (slabp->inuse == 0) {
c01082f6:	8b 45 0c             	mov    0xc(%ebp),%eax
c01082f9:	8b 40 0c             	mov    0xc(%eax),%eax
c01082fc:	85 c0                	test   %eax,%eax
c01082fe:	75 3f                	jne    c010833f <kmem_cache_free_one+0xa1>
        list_del(&(slabp->slab_link));
c0108300:	8b 45 0c             	mov    0xc(%ebp),%eax
c0108303:	89 45 c4             	mov    %eax,-0x3c(%ebp)
 * Note: list_empty() on @listelm does not return true after this, the entry is
 * in an undefined state.
 * */
static inline void
list_del(list_entry_t *listelm) {
    __list_del(listelm->prev, listelm->next);
c0108306:	8b 45 c4             	mov    -0x3c(%ebp),%eax
c0108309:	8b 40 04             	mov    0x4(%eax),%eax
c010830c:	8b 55 c4             	mov    -0x3c(%ebp),%edx
c010830f:	8b 12                	mov    (%edx),%edx
c0108311:	89 55 cc             	mov    %edx,-0x34(%ebp)
c0108314:	89 45 c8             	mov    %eax,-0x38(%ebp)
 * This is only for internal list manipulation where we know
 * the prev/next entries already!
 * */
static inline void
__list_del(list_entry_t *prev, list_entry_t *next) {
    prev->next = next;
c0108317:	8b 45 cc             	mov    -0x34(%ebp),%eax
c010831a:	8b 55 c8             	mov    -0x38(%ebp),%edx
c010831d:	89 50 04             	mov    %edx,0x4(%eax)
    next->prev = prev;
c0108320:	8b 45 c8             	mov    -0x38(%ebp),%eax
c0108323:	8b 55 cc             	mov    -0x34(%ebp),%edx
c0108326:	89 10                	mov    %edx,(%eax)
        kmem_slab_destroy(cachep, slabp);
c0108328:	8b 45 0c             	mov    0xc(%ebp),%eax
c010832b:	89 44 24 04          	mov    %eax,0x4(%esp)
c010832f:	8b 45 08             	mov    0x8(%ebp),%eax
c0108332:	89 04 24             	mov    %eax,(%esp)
c0108335:	e8 67 fe ff ff       	call   c01081a1 <kmem_slab_destroy>
c010833a:	e9 8f 00 00 00       	jmp    c01083ce <kmem_cache_free_one+0x130>
    }
    else if (slabp->inuse == cachep->num -1 ) {
c010833f:	8b 45 0c             	mov    0xc(%ebp),%eax
c0108342:	8b 50 0c             	mov    0xc(%eax),%edx
c0108345:	8b 45 08             	mov    0x8(%ebp),%eax
c0108348:	8b 40 14             	mov    0x14(%eax),%eax
c010834b:	83 e8 01             	sub    $0x1,%eax
c010834e:	39 c2                	cmp    %eax,%edx
c0108350:	75 7c                	jne    c01083ce <kmem_cache_free_one+0x130>
        list_del(&(slabp->slab_link));
c0108352:	8b 45 0c             	mov    0xc(%ebp),%eax
c0108355:	89 45 d0             	mov    %eax,-0x30(%ebp)
 * Note: list_empty() on @listelm does not return true after this, the entry is
 * in an undefined state.
 * */
static inline void
list_del(list_entry_t *listelm) {
    __list_del(listelm->prev, listelm->next);
c0108358:	8b 45 d0             	mov    -0x30(%ebp),%eax
c010835b:	8b 40 04             	mov    0x4(%eax),%eax
c010835e:	8b 55 d0             	mov    -0x30(%ebp),%edx
c0108361:	8b 12                	mov    (%edx),%edx
c0108363:	89 55 d8             	mov    %edx,-0x28(%ebp)
c0108366:	89 45 d4             	mov    %eax,-0x2c(%ebp)
 * This is only for internal list manipulation where we know
 * the prev/next entries already!
 * */
static inline void
__list_del(list_entry_t *prev, list_entry_t *next) {
    prev->next = next;
c0108369:	8b 45 d8             	mov    -0x28(%ebp),%eax
c010836c:	8b 55 d4             	mov    -0x2c(%ebp),%edx
c010836f:	89 50 04             	mov    %edx,0x4(%eax)
    next->prev = prev;
c0108372:	8b 45 d4             	mov    -0x2c(%ebp),%eax
c0108375:	8b 55 d8             	mov    -0x28(%ebp),%edx
c0108378:	89 10                	mov    %edx,(%eax)
        list_add(&(cachep->slabs_notfull), &(slabp->slab_link));
c010837a:	8b 45 0c             	mov    0xc(%ebp),%eax
c010837d:	8b 55 08             	mov    0x8(%ebp),%edx
c0108380:	83 c2 08             	add    $0x8,%edx
c0108383:	89 55 e0             	mov    %edx,-0x20(%ebp)
c0108386:	89 45 dc             	mov    %eax,-0x24(%ebp)
c0108389:	8b 45 e0             	mov    -0x20(%ebp),%eax
c010838c:	89 45 e8             	mov    %eax,-0x18(%ebp)
c010838f:	8b 45 dc             	mov    -0x24(%ebp),%eax
c0108392:	89 45 e4             	mov    %eax,-0x1c(%ebp)
 * Insert the new element @elm *after* the element @listelm which
 * is already in the list.
 * */
static inline void
list_add_after(list_entry_t *listelm, list_entry_t *elm) {
    __list_add(elm, listelm, listelm->next);
c0108395:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0108398:	8b 40 04             	mov    0x4(%eax),%eax
c010839b:	8b 55 e4             	mov    -0x1c(%ebp),%edx
c010839e:	89 55 f4             	mov    %edx,-0xc(%ebp)
c01083a1:	8b 55 e8             	mov    -0x18(%ebp),%edx
c01083a4:	89 55 f0             	mov    %edx,-0x10(%ebp)
c01083a7:	89 45 ec             	mov    %eax,-0x14(%ebp)
 * This is only for internal list manipulation where we know
 * the prev/next entries already!
 * */
static inline void
__list_add(list_entry_t *elm, list_entry_t *prev, list_entry_t *next) {
    prev->next = next->prev = elm;
c01083aa:	8b 45 ec             	mov    -0x14(%ebp),%eax
c01083ad:	8b 55 f4             	mov    -0xc(%ebp),%edx
c01083b0:	89 10                	mov    %edx,(%eax)
c01083b2:	8b 45 ec             	mov    -0x14(%ebp),%eax
c01083b5:	8b 10                	mov    (%eax),%edx
c01083b7:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01083ba:	89 50 04             	mov    %edx,0x4(%eax)
    elm->next = next;
c01083bd:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01083c0:	8b 55 ec             	mov    -0x14(%ebp),%edx
c01083c3:	89 50 04             	mov    %edx,0x4(%eax)
    elm->prev = prev;
c01083c6:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01083c9:	8b 55 f0             	mov    -0x10(%ebp),%edx
c01083cc:	89 10                	mov    %edx,(%eax)
    }
}
c01083ce:	c9                   	leave  
c01083cf:	c3                   	ret    

c01083d0 <kmem_cache_free>:
#define GET_PAGE_SLAB(page)                                 \
    (slab_t *)((page)->page_link.prev)

// kmem_cache_free - call kmem_cache_free_one function to free an obj 
static void
kmem_cache_free(kmem_cache_t *cachep, void *objp) {
c01083d0:	55                   	push   %ebp
c01083d1:	89 e5                	mov    %esp,%ebp
c01083d3:	83 ec 38             	sub    $0x38,%esp
    bool intr_flag;
    struct Page *page = kva2page(objp);
c01083d6:	8b 45 0c             	mov    0xc(%ebp),%eax
c01083d9:	89 04 24             	mov    %eax,(%esp)
c01083dc:	e8 91 f4 ff ff       	call   c0107872 <kva2page>
c01083e1:	89 45 e8             	mov    %eax,-0x18(%ebp)

    if (!PageSlab(page)) {
c01083e4:	8b 45 e8             	mov    -0x18(%ebp),%eax
c01083e7:	83 c0 04             	add    $0x4,%eax
c01083ea:	c7 45 f0 02 00 00 00 	movl   $0x2,-0x10(%ebp)
c01083f1:	89 45 ec             	mov    %eax,-0x14(%ebp)
 * @addr:   the address to count from
 * */
static inline bool
test_bit(int nr, volatile void *addr) {
    int oldbit;
    asm volatile ("btl %2, %1; sbbl %0,%0" : "=r" (oldbit) : "m" (*(volatile long *)addr), "Ir" (nr));
c01083f4:	8b 45 ec             	mov    -0x14(%ebp),%eax
c01083f7:	8b 55 f0             	mov    -0x10(%ebp),%edx
c01083fa:	0f a3 10             	bt     %edx,(%eax)
c01083fd:	19 c0                	sbb    %eax,%eax
c01083ff:	89 45 f4             	mov    %eax,-0xc(%ebp)
    return oldbit != 0;
c0108402:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c0108406:	0f 95 c0             	setne  %al
c0108409:	0f b6 c0             	movzbl %al,%eax
c010840c:	85 c0                	test   %eax,%eax
c010840e:	75 23                	jne    c0108433 <kmem_cache_free+0x63>
        panic("not a slab page %08x\n", objp);
c0108410:	8b 45 0c             	mov    0xc(%ebp),%eax
c0108413:	89 44 24 0c          	mov    %eax,0xc(%esp)
c0108417:	c7 44 24 08 71 c8 10 	movl   $0xc010c871,0x8(%esp)
c010841e:	c0 
c010841f:	c7 44 24 04 bf 01 00 	movl   $0x1bf,0x4(%esp)
c0108426:	00 
c0108427:	c7 04 24 f6 c7 10 c0 	movl   $0xc010c7f6,(%esp)
c010842e:	e8 7d a6 ff ff       	call   c0102ab0 <__panic>
    }
    local_intr_save(intr_flag);
c0108433:	e8 28 f3 ff ff       	call   c0107760 <__intr_save>
c0108438:	89 45 e4             	mov    %eax,-0x1c(%ebp)
    {
        kmem_cache_free_one(cachep, GET_PAGE_SLAB(page), objp);
c010843b:	8b 45 e8             	mov    -0x18(%ebp),%eax
c010843e:	8b 40 10             	mov    0x10(%eax),%eax
c0108441:	8b 55 0c             	mov    0xc(%ebp),%edx
c0108444:	89 54 24 08          	mov    %edx,0x8(%esp)
c0108448:	89 44 24 04          	mov    %eax,0x4(%esp)
c010844c:	8b 45 08             	mov    0x8(%ebp),%eax
c010844f:	89 04 24             	mov    %eax,(%esp)
c0108452:	e8 47 fe ff ff       	call   c010829e <kmem_cache_free_one>
    }
    local_intr_restore(intr_flag);
c0108457:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c010845a:	89 04 24             	mov    %eax,(%esp)
c010845d:	e8 28 f3 ff ff       	call   c010778a <__intr_restore>
}
c0108462:	c9                   	leave  
c0108463:	c3                   	ret    

c0108464 <kfree>:

// kfree - simple interface used by ooutside functions to free an obj
void
kfree(void *objp) {
c0108464:	55                   	push   %ebp
c0108465:	89 e5                	mov    %esp,%ebp
c0108467:	83 ec 18             	sub    $0x18,%esp
    kmem_cache_free(GET_PAGE_CACHE(kva2page(objp)), objp);
c010846a:	8b 45 08             	mov    0x8(%ebp),%eax
c010846d:	89 04 24             	mov    %eax,(%esp)
c0108470:	e8 fd f3 ff ff       	call   c0107872 <kva2page>
c0108475:	8b 40 14             	mov    0x14(%eax),%eax
c0108478:	8b 55 08             	mov    0x8(%ebp),%edx
c010847b:	89 54 24 04          	mov    %edx,0x4(%esp)
c010847f:	89 04 24             	mov    %eax,(%esp)
c0108482:	e8 49 ff ff ff       	call   c01083d0 <kmem_cache_free>
}
c0108487:	c9                   	leave  
c0108488:	c3                   	ret    

c0108489 <check_slab_empty>:

static inline void
check_slab_empty(void) {
c0108489:	55                   	push   %ebp
c010848a:	89 e5                	mov    %esp,%ebp
c010848c:	83 ec 28             	sub    $0x28,%esp
    int i;
    for (i = 0; i < SLAB_CACHE_NUM; i ++) {
c010848f:	c7 45 e8 00 00 00 00 	movl   $0x0,-0x18(%ebp)
c0108496:	e9 96 00 00 00       	jmp    c0108531 <check_slab_empty+0xa8>
        kmem_cache_t *cachep = slab_cache + i;
c010849b:	8b 55 e8             	mov    -0x18(%ebp),%edx
c010849e:	89 d0                	mov    %edx,%eax
c01084a0:	c1 e0 02             	shl    $0x2,%eax
c01084a3:	01 d0                	add    %edx,%eax
c01084a5:	c1 e0 03             	shl    $0x3,%eax
c01084a8:	05 a0 8a 12 c0       	add    $0xc0128aa0,%eax
c01084ad:	89 45 ec             	mov    %eax,-0x14(%ebp)
        assert(list_empty(&(cachep->slabs_full)));
c01084b0:	8b 45 ec             	mov    -0x14(%ebp),%eax
c01084b3:	89 45 f0             	mov    %eax,-0x10(%ebp)
 * list_empty - tests whether a list is empty
 * @list:       the list to test.
 * */
static inline bool
list_empty(list_entry_t *list) {
    return list->next == list;
c01084b6:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01084b9:	8b 40 04             	mov    0x4(%eax),%eax
c01084bc:	39 45 f0             	cmp    %eax,-0x10(%ebp)
c01084bf:	0f 94 c0             	sete   %al
c01084c2:	0f b6 c0             	movzbl %al,%eax
c01084c5:	85 c0                	test   %eax,%eax
c01084c7:	75 24                	jne    c01084ed <check_slab_empty+0x64>
c01084c9:	c7 44 24 0c 88 c8 10 	movl   $0xc010c888,0xc(%esp)
c01084d0:	c0 
c01084d1:	c7 44 24 08 47 c8 10 	movl   $0xc010c847,0x8(%esp)
c01084d8:	c0 
c01084d9:	c7 44 24 04 d3 01 00 	movl   $0x1d3,0x4(%esp)
c01084e0:	00 
c01084e1:	c7 04 24 f6 c7 10 c0 	movl   $0xc010c7f6,(%esp)
c01084e8:	e8 c3 a5 ff ff       	call   c0102ab0 <__panic>
        assert(list_empty(&(cachep->slabs_notfull)));
c01084ed:	8b 45 ec             	mov    -0x14(%ebp),%eax
c01084f0:	83 c0 08             	add    $0x8,%eax
c01084f3:	89 45 f4             	mov    %eax,-0xc(%ebp)
c01084f6:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01084f9:	8b 40 04             	mov    0x4(%eax),%eax
c01084fc:	39 45 f4             	cmp    %eax,-0xc(%ebp)
c01084ff:	0f 94 c0             	sete   %al
c0108502:	0f b6 c0             	movzbl %al,%eax
c0108505:	85 c0                	test   %eax,%eax
c0108507:	75 24                	jne    c010852d <check_slab_empty+0xa4>
c0108509:	c7 44 24 0c ac c8 10 	movl   $0xc010c8ac,0xc(%esp)
c0108510:	c0 
c0108511:	c7 44 24 08 47 c8 10 	movl   $0xc010c847,0x8(%esp)
c0108518:	c0 
c0108519:	c7 44 24 04 d4 01 00 	movl   $0x1d4,0x4(%esp)
c0108520:	00 
c0108521:	c7 04 24 f6 c7 10 c0 	movl   $0xc010c7f6,(%esp)
c0108528:	e8 83 a5 ff ff       	call   c0102ab0 <__panic>
}

static inline void
check_slab_empty(void) {
    int i;
    for (i = 0; i < SLAB_CACHE_NUM; i ++) {
c010852d:	83 45 e8 01          	addl   $0x1,-0x18(%ebp)
c0108531:	83 7d e8 0c          	cmpl   $0xc,-0x18(%ebp)
c0108535:	0f 8e 60 ff ff ff    	jle    c010849b <check_slab_empty+0x12>
        kmem_cache_t *cachep = slab_cache + i;
        assert(list_empty(&(cachep->slabs_full)));
        assert(list_empty(&(cachep->slabs_notfull)));
    }
}
c010853b:	c9                   	leave  
c010853c:	c3                   	ret    

c010853d <check_slab>:

void
check_slab(void) {
c010853d:	55                   	push   %ebp
c010853e:	89 e5                	mov    %esp,%ebp
c0108540:	53                   	push   %ebx
c0108541:	81 ec f4 00 00 00    	sub    $0xf4,%esp
    int i;
    void *v0, *v1;

    size_t nr_free_pages_store = nr_free_pages();
c0108547:	e8 e5 da ff ff       	call   c0106031 <nr_free_pages>
c010854c:	89 85 2c ff ff ff    	mov    %eax,-0xd4(%ebp)
    size_t slab_allocated_store = slab_allocated();
c0108552:	e8 cc f3 ff ff       	call   c0107923 <slab_allocated>
c0108557:	89 85 30 ff ff ff    	mov    %eax,-0xd0(%ebp)

    /* slab must be empty now */
    check_slab_empty();
c010855d:	e8 27 ff ff ff       	call   c0108489 <check_slab_empty>
    assert(slab_allocated() == 0);
c0108562:	e8 bc f3 ff ff       	call   c0107923 <slab_allocated>
c0108567:	85 c0                	test   %eax,%eax
c0108569:	74 24                	je     c010858f <check_slab+0x52>
c010856b:	c7 44 24 0c d1 c8 10 	movl   $0xc010c8d1,0xc(%esp)
c0108572:	c0 
c0108573:	c7 44 24 08 47 c8 10 	movl   $0xc010c847,0x8(%esp)
c010857a:	c0 
c010857b:	c7 44 24 04 e2 01 00 	movl   $0x1e2,0x4(%esp)
c0108582:	00 
c0108583:	c7 04 24 f6 c7 10 c0 	movl   $0xc010c7f6,(%esp)
c010858a:	e8 21 a5 ff ff       	call   c0102ab0 <__panic>

    kmem_cache_t *cachep0, *cachep1;

    cachep0 = slab_cache;
c010858f:	c7 85 34 ff ff ff a0 	movl   $0xc0128aa0,-0xcc(%ebp)
c0108596:	8a 12 c0 
    assert(cachep0->objsize == 32 && cachep0->num > 1 && !cachep0->off_slab);
c0108599:	8b 85 34 ff ff ff    	mov    -0xcc(%ebp),%eax
c010859f:	8b 40 10             	mov    0x10(%eax),%eax
c01085a2:	83 f8 20             	cmp    $0x20,%eax
c01085a5:	75 1b                	jne    c01085c2 <check_slab+0x85>
c01085a7:	8b 85 34 ff ff ff    	mov    -0xcc(%ebp),%eax
c01085ad:	8b 40 14             	mov    0x14(%eax),%eax
c01085b0:	83 f8 01             	cmp    $0x1,%eax
c01085b3:	76 0d                	jbe    c01085c2 <check_slab+0x85>
c01085b5:	8b 85 34 ff ff ff    	mov    -0xcc(%ebp),%eax
c01085bb:	8b 40 1c             	mov    0x1c(%eax),%eax
c01085be:	85 c0                	test   %eax,%eax
c01085c0:	74 24                	je     c01085e6 <check_slab+0xa9>
c01085c2:	c7 44 24 0c e8 c8 10 	movl   $0xc010c8e8,0xc(%esp)
c01085c9:	c0 
c01085ca:	c7 44 24 08 47 c8 10 	movl   $0xc010c847,0x8(%esp)
c01085d1:	c0 
c01085d2:	c7 44 24 04 e7 01 00 	movl   $0x1e7,0x4(%esp)
c01085d9:	00 
c01085da:	c7 04 24 f6 c7 10 c0 	movl   $0xc010c7f6,(%esp)
c01085e1:	e8 ca a4 ff ff       	call   c0102ab0 <__panic>
    assert((v0 = kmalloc(16)) != NULL);
c01085e6:	c7 04 24 10 00 00 00 	movl   $0x10,(%esp)
c01085ed:	e8 43 fb ff ff       	call   c0108135 <kmalloc>
c01085f2:	89 85 24 ff ff ff    	mov    %eax,-0xdc(%ebp)
c01085f8:	83 bd 24 ff ff ff 00 	cmpl   $0x0,-0xdc(%ebp)
c01085ff:	75 24                	jne    c0108625 <check_slab+0xe8>
c0108601:	c7 44 24 0c 29 c9 10 	movl   $0xc010c929,0xc(%esp)
c0108608:	c0 
c0108609:	c7 44 24 08 47 c8 10 	movl   $0xc010c847,0x8(%esp)
c0108610:	c0 
c0108611:	c7 44 24 04 e8 01 00 	movl   $0x1e8,0x4(%esp)
c0108618:	00 
c0108619:	c7 04 24 f6 c7 10 c0 	movl   $0xc010c7f6,(%esp)
c0108620:	e8 8b a4 ff ff       	call   c0102ab0 <__panic>

    slab_t *slabp0, *slabp1;

    assert(!list_empty(&(cachep0->slabs_notfull)));
c0108625:	8b 85 34 ff ff ff    	mov    -0xcc(%ebp),%eax
c010862b:	83 c0 08             	add    $0x8,%eax
c010862e:	89 85 54 ff ff ff    	mov    %eax,-0xac(%ebp)
c0108634:	8b 85 54 ff ff ff    	mov    -0xac(%ebp),%eax
c010863a:	8b 40 04             	mov    0x4(%eax),%eax
c010863d:	39 85 54 ff ff ff    	cmp    %eax,-0xac(%ebp)
c0108643:	0f 94 c0             	sete   %al
c0108646:	0f b6 c0             	movzbl %al,%eax
c0108649:	85 c0                	test   %eax,%eax
c010864b:	74 24                	je     c0108671 <check_slab+0x134>
c010864d:	c7 44 24 0c 44 c9 10 	movl   $0xc010c944,0xc(%esp)
c0108654:	c0 
c0108655:	c7 44 24 08 47 c8 10 	movl   $0xc010c847,0x8(%esp)
c010865c:	c0 
c010865d:	c7 44 24 04 ec 01 00 	movl   $0x1ec,0x4(%esp)
c0108664:	00 
c0108665:	c7 04 24 f6 c7 10 c0 	movl   $0xc010c7f6,(%esp)
c010866c:	e8 3f a4 ff ff       	call   c0102ab0 <__panic>
    slabp0 = le2slab(list_next(&(cachep0->slabs_notfull)), slab_link);
c0108671:	8b 85 34 ff ff ff    	mov    -0xcc(%ebp),%eax
c0108677:	83 c0 08             	add    $0x8,%eax
c010867a:	89 85 58 ff ff ff    	mov    %eax,-0xa8(%ebp)
 * list_next - get the next entry
 * @listelm:    the list head
 **/
static list_entry_t *
list_next(list_entry_t *listelm) {
    return listelm->next;
c0108680:	8b 85 58 ff ff ff    	mov    -0xa8(%ebp),%eax
c0108686:	8b 40 04             	mov    0x4(%eax),%eax
c0108689:	89 85 3c ff ff ff    	mov    %eax,-0xc4(%ebp)
    assert(slabp0->inuse == 1 && list_next(&(slabp0->slab_link)) == &(cachep0->slabs_notfull));
c010868f:	8b 85 3c ff ff ff    	mov    -0xc4(%ebp),%eax
c0108695:	8b 40 0c             	mov    0xc(%eax),%eax
c0108698:	83 f8 01             	cmp    $0x1,%eax
c010869b:	75 22                	jne    c01086bf <check_slab+0x182>
c010869d:	8b 85 3c ff ff ff    	mov    -0xc4(%ebp),%eax
c01086a3:	89 85 5c ff ff ff    	mov    %eax,-0xa4(%ebp)
c01086a9:	8b 85 5c ff ff ff    	mov    -0xa4(%ebp),%eax
c01086af:	8b 40 04             	mov    0x4(%eax),%eax
c01086b2:	8b 95 34 ff ff ff    	mov    -0xcc(%ebp),%edx
c01086b8:	83 c2 08             	add    $0x8,%edx
c01086bb:	39 d0                	cmp    %edx,%eax
c01086bd:	74 24                	je     c01086e3 <check_slab+0x1a6>
c01086bf:	c7 44 24 0c 6c c9 10 	movl   $0xc010c96c,0xc(%esp)
c01086c6:	c0 
c01086c7:	c7 44 24 08 47 c8 10 	movl   $0xc010c847,0x8(%esp)
c01086ce:	c0 
c01086cf:	c7 44 24 04 ee 01 00 	movl   $0x1ee,0x4(%esp)
c01086d6:	00 
c01086d7:	c7 04 24 f6 c7 10 c0 	movl   $0xc010c7f6,(%esp)
c01086de:	e8 cd a3 ff ff       	call   c0102ab0 <__panic>

    struct Page *p0, *p1;
    size_t order_size;


    p0 = kva2page(slabp0->s_mem - slabp0->offset), p1 = p0;
c01086e3:	8b 85 3c ff ff ff    	mov    -0xc4(%ebp),%eax
c01086e9:	8b 50 08             	mov    0x8(%eax),%edx
c01086ec:	8b 85 3c ff ff ff    	mov    -0xc4(%ebp),%eax
c01086f2:	8b 40 10             	mov    0x10(%eax),%eax
c01086f5:	f7 d8                	neg    %eax
c01086f7:	8d 04 02             	lea    (%edx,%eax,1),%eax
c01086fa:	89 04 24             	mov    %eax,(%esp)
c01086fd:	e8 70 f1 ff ff       	call   c0107872 <kva2page>
c0108702:	89 85 44 ff ff ff    	mov    %eax,-0xbc(%ebp)
c0108708:	8b 85 44 ff ff ff    	mov    -0xbc(%ebp),%eax
c010870e:	89 85 48 ff ff ff    	mov    %eax,-0xb8(%ebp)
    order_size = (1 << cachep0->page_order);
c0108714:	8b 85 34 ff ff ff    	mov    -0xcc(%ebp),%eax
c010871a:	8b 40 20             	mov    0x20(%eax),%eax
c010871d:	ba 01 00 00 00       	mov    $0x1,%edx
c0108722:	89 d3                	mov    %edx,%ebx
c0108724:	89 c1                	mov    %eax,%ecx
c0108726:	d3 e3                	shl    %cl,%ebx
c0108728:	89 d8                	mov    %ebx,%eax
c010872a:	89 85 4c ff ff ff    	mov    %eax,-0xb4(%ebp)
    for (i = 0; i < cachep0->page_order; i ++, p1 ++) {
c0108730:	c7 85 20 ff ff ff 00 	movl   $0x0,-0xe0(%ebp)
c0108737:	00 00 00 
c010873a:	e9 b9 00 00 00       	jmp    c01087f8 <check_slab+0x2bb>
        assert(PageSlab(p1));
c010873f:	8b 85 48 ff ff ff    	mov    -0xb8(%ebp),%eax
c0108745:	83 c0 04             	add    $0x4,%eax
c0108748:	c7 85 64 ff ff ff 02 	movl   $0x2,-0x9c(%ebp)
c010874f:	00 00 00 
c0108752:	89 85 60 ff ff ff    	mov    %eax,-0xa0(%ebp)
 * @addr:   the address to count from
 * */
static inline bool
test_bit(int nr, volatile void *addr) {
    int oldbit;
    asm volatile ("btl %2, %1; sbbl %0,%0" : "=r" (oldbit) : "m" (*(volatile long *)addr), "Ir" (nr));
c0108758:	8b 85 60 ff ff ff    	mov    -0xa0(%ebp),%eax
c010875e:	8b 95 64 ff ff ff    	mov    -0x9c(%ebp),%edx
c0108764:	0f a3 10             	bt     %edx,(%eax)
c0108767:	19 c0                	sbb    %eax,%eax
c0108769:	89 85 68 ff ff ff    	mov    %eax,-0x98(%ebp)
    return oldbit != 0;
c010876f:	83 bd 68 ff ff ff 00 	cmpl   $0x0,-0x98(%ebp)
c0108776:	0f 95 c0             	setne  %al
c0108779:	0f b6 c0             	movzbl %al,%eax
c010877c:	85 c0                	test   %eax,%eax
c010877e:	75 24                	jne    c01087a4 <check_slab+0x267>
c0108780:	c7 44 24 0c bf c9 10 	movl   $0xc010c9bf,0xc(%esp)
c0108787:	c0 
c0108788:	c7 44 24 08 47 c8 10 	movl   $0xc010c847,0x8(%esp)
c010878f:	c0 
c0108790:	c7 44 24 04 f7 01 00 	movl   $0x1f7,0x4(%esp)
c0108797:	00 
c0108798:	c7 04 24 f6 c7 10 c0 	movl   $0xc010c7f6,(%esp)
c010879f:	e8 0c a3 ff ff       	call   c0102ab0 <__panic>
        assert(GET_PAGE_CACHE(p1) == cachep0 && GET_PAGE_SLAB(p1) == slabp0);
c01087a4:	8b 85 48 ff ff ff    	mov    -0xb8(%ebp),%eax
c01087aa:	8b 40 14             	mov    0x14(%eax),%eax
c01087ad:	3b 85 34 ff ff ff    	cmp    -0xcc(%ebp),%eax
c01087b3:	75 11                	jne    c01087c6 <check_slab+0x289>
c01087b5:	8b 85 48 ff ff ff    	mov    -0xb8(%ebp),%eax
c01087bb:	8b 40 10             	mov    0x10(%eax),%eax
c01087be:	3b 85 3c ff ff ff    	cmp    -0xc4(%ebp),%eax
c01087c4:	74 24                	je     c01087ea <check_slab+0x2ad>
c01087c6:	c7 44 24 0c cc c9 10 	movl   $0xc010c9cc,0xc(%esp)
c01087cd:	c0 
c01087ce:	c7 44 24 08 47 c8 10 	movl   $0xc010c847,0x8(%esp)
c01087d5:	c0 
c01087d6:	c7 44 24 04 f8 01 00 	movl   $0x1f8,0x4(%esp)
c01087dd:	00 
c01087de:	c7 04 24 f6 c7 10 c0 	movl   $0xc010c7f6,(%esp)
c01087e5:	e8 c6 a2 ff ff       	call   c0102ab0 <__panic>
    size_t order_size;


    p0 = kva2page(slabp0->s_mem - slabp0->offset), p1 = p0;
    order_size = (1 << cachep0->page_order);
    for (i = 0; i < cachep0->page_order; i ++, p1 ++) {
c01087ea:	83 85 20 ff ff ff 01 	addl   $0x1,-0xe0(%ebp)
c01087f1:	83 85 48 ff ff ff 18 	addl   $0x18,-0xb8(%ebp)
c01087f8:	8b 95 20 ff ff ff    	mov    -0xe0(%ebp),%edx
c01087fe:	8b 85 34 ff ff ff    	mov    -0xcc(%ebp),%eax
c0108804:	8b 40 20             	mov    0x20(%eax),%eax
c0108807:	39 c2                	cmp    %eax,%edx
c0108809:	0f 82 30 ff ff ff    	jb     c010873f <check_slab+0x202>
        assert(PageSlab(p1));
        assert(GET_PAGE_CACHE(p1) == cachep0 && GET_PAGE_SLAB(p1) == slabp0);
    }

    assert(v0 == slabp0->s_mem);
c010880f:	8b 85 3c ff ff ff    	mov    -0xc4(%ebp),%eax
c0108815:	8b 40 08             	mov    0x8(%eax),%eax
c0108818:	3b 85 24 ff ff ff    	cmp    -0xdc(%ebp),%eax
c010881e:	74 24                	je     c0108844 <check_slab+0x307>
c0108820:	c7 44 24 0c 09 ca 10 	movl   $0xc010ca09,0xc(%esp)
c0108827:	c0 
c0108828:	c7 44 24 08 47 c8 10 	movl   $0xc010c847,0x8(%esp)
c010882f:	c0 
c0108830:	c7 44 24 04 fb 01 00 	movl   $0x1fb,0x4(%esp)
c0108837:	00 
c0108838:	c7 04 24 f6 c7 10 c0 	movl   $0xc010c7f6,(%esp)
c010883f:	e8 6c a2 ff ff       	call   c0102ab0 <__panic>
    assert((v1 = kmalloc(16)) != NULL && v1 == v0 + 32);
c0108844:	c7 04 24 10 00 00 00 	movl   $0x10,(%esp)
c010884b:	e8 e5 f8 ff ff       	call   c0108135 <kmalloc>
c0108850:	89 85 28 ff ff ff    	mov    %eax,-0xd8(%ebp)
c0108856:	83 bd 28 ff ff ff 00 	cmpl   $0x0,-0xd8(%ebp)
c010885d:	74 11                	je     c0108870 <check_slab+0x333>
c010885f:	8b 85 24 ff ff ff    	mov    -0xdc(%ebp),%eax
c0108865:	83 c0 20             	add    $0x20,%eax
c0108868:	3b 85 28 ff ff ff    	cmp    -0xd8(%ebp),%eax
c010886e:	74 24                	je     c0108894 <check_slab+0x357>
c0108870:	c7 44 24 0c 20 ca 10 	movl   $0xc010ca20,0xc(%esp)
c0108877:	c0 
c0108878:	c7 44 24 08 47 c8 10 	movl   $0xc010c847,0x8(%esp)
c010887f:	c0 
c0108880:	c7 44 24 04 fc 01 00 	movl   $0x1fc,0x4(%esp)
c0108887:	00 
c0108888:	c7 04 24 f6 c7 10 c0 	movl   $0xc010c7f6,(%esp)
c010888f:	e8 1c a2 ff ff       	call   c0102ab0 <__panic>

    kfree(v0);
c0108894:	8b 85 24 ff ff ff    	mov    -0xdc(%ebp),%eax
c010889a:	89 04 24             	mov    %eax,(%esp)
c010889d:	e8 c2 fb ff ff       	call   c0108464 <kfree>
    assert(slabp0->free == 0);
c01088a2:	8b 85 3c ff ff ff    	mov    -0xc4(%ebp),%eax
c01088a8:	8b 40 14             	mov    0x14(%eax),%eax
c01088ab:	85 c0                	test   %eax,%eax
c01088ad:	74 24                	je     c01088d3 <check_slab+0x396>
c01088af:	c7 44 24 0c 4c ca 10 	movl   $0xc010ca4c,0xc(%esp)
c01088b6:	c0 
c01088b7:	c7 44 24 08 47 c8 10 	movl   $0xc010c847,0x8(%esp)
c01088be:	c0 
c01088bf:	c7 44 24 04 ff 01 00 	movl   $0x1ff,0x4(%esp)
c01088c6:	00 
c01088c7:	c7 04 24 f6 c7 10 c0 	movl   $0xc010c7f6,(%esp)
c01088ce:	e8 dd a1 ff ff       	call   c0102ab0 <__panic>
    kfree(v1);
c01088d3:	8b 85 28 ff ff ff    	mov    -0xd8(%ebp),%eax
c01088d9:	89 04 24             	mov    %eax,(%esp)
c01088dc:	e8 83 fb ff ff       	call   c0108464 <kfree>
    assert(list_empty(&(cachep0->slabs_notfull)));
c01088e1:	8b 85 34 ff ff ff    	mov    -0xcc(%ebp),%eax
c01088e7:	83 c0 08             	add    $0x8,%eax
c01088ea:	89 85 6c ff ff ff    	mov    %eax,-0x94(%ebp)
 * list_empty - tests whether a list is empty
 * @list:       the list to test.
 * */
static inline bool
list_empty(list_entry_t *list) {
    return list->next == list;
c01088f0:	8b 85 6c ff ff ff    	mov    -0x94(%ebp),%eax
c01088f6:	8b 40 04             	mov    0x4(%eax),%eax
c01088f9:	39 85 6c ff ff ff    	cmp    %eax,-0x94(%ebp)
c01088ff:	0f 94 c0             	sete   %al
c0108902:	0f b6 c0             	movzbl %al,%eax
c0108905:	85 c0                	test   %eax,%eax
c0108907:	75 24                	jne    c010892d <check_slab+0x3f0>
c0108909:	c7 44 24 0c 60 ca 10 	movl   $0xc010ca60,0xc(%esp)
c0108910:	c0 
c0108911:	c7 44 24 08 47 c8 10 	movl   $0xc010c847,0x8(%esp)
c0108918:	c0 
c0108919:	c7 44 24 04 01 02 00 	movl   $0x201,0x4(%esp)
c0108920:	00 
c0108921:	c7 04 24 f6 c7 10 c0 	movl   $0xc010c7f6,(%esp)
c0108928:	e8 83 a1 ff ff       	call   c0102ab0 <__panic>

    for (i = 0; i < cachep0->page_order; i ++, p0 ++) {
c010892d:	c7 85 20 ff ff ff 00 	movl   $0x0,-0xe0(%ebp)
c0108934:	00 00 00 
c0108937:	eb 73                	jmp    c01089ac <check_slab+0x46f>
        assert(!PageSlab(p0));
c0108939:	8b 85 44 ff ff ff    	mov    -0xbc(%ebp),%eax
c010893f:	83 c0 04             	add    $0x4,%eax
c0108942:	c7 85 74 ff ff ff 02 	movl   $0x2,-0x8c(%ebp)
c0108949:	00 00 00 
c010894c:	89 85 70 ff ff ff    	mov    %eax,-0x90(%ebp)
 * @addr:   the address to count from
 * */
static inline bool
test_bit(int nr, volatile void *addr) {
    int oldbit;
    asm volatile ("btl %2, %1; sbbl %0,%0" : "=r" (oldbit) : "m" (*(volatile long *)addr), "Ir" (nr));
c0108952:	8b 85 70 ff ff ff    	mov    -0x90(%ebp),%eax
c0108958:	8b 95 74 ff ff ff    	mov    -0x8c(%ebp),%edx
c010895e:	0f a3 10             	bt     %edx,(%eax)
c0108961:	19 c0                	sbb    %eax,%eax
c0108963:	89 85 78 ff ff ff    	mov    %eax,-0x88(%ebp)
    return oldbit != 0;
c0108969:	83 bd 78 ff ff ff 00 	cmpl   $0x0,-0x88(%ebp)
c0108970:	0f 95 c0             	setne  %al
c0108973:	0f b6 c0             	movzbl %al,%eax
c0108976:	85 c0                	test   %eax,%eax
c0108978:	74 24                	je     c010899e <check_slab+0x461>
c010897a:	c7 44 24 0c 86 ca 10 	movl   $0xc010ca86,0xc(%esp)
c0108981:	c0 
c0108982:	c7 44 24 08 47 c8 10 	movl   $0xc010c847,0x8(%esp)
c0108989:	c0 
c010898a:	c7 44 24 04 04 02 00 	movl   $0x204,0x4(%esp)
c0108991:	00 
c0108992:	c7 04 24 f6 c7 10 c0 	movl   $0xc010c7f6,(%esp)
c0108999:	e8 12 a1 ff ff       	call   c0102ab0 <__panic>
    kfree(v0);
    assert(slabp0->free == 0);
    kfree(v1);
    assert(list_empty(&(cachep0->slabs_notfull)));

    for (i = 0; i < cachep0->page_order; i ++, p0 ++) {
c010899e:	83 85 20 ff ff ff 01 	addl   $0x1,-0xe0(%ebp)
c01089a5:	83 85 44 ff ff ff 18 	addl   $0x18,-0xbc(%ebp)
c01089ac:	8b 95 20 ff ff ff    	mov    -0xe0(%ebp),%edx
c01089b2:	8b 85 34 ff ff ff    	mov    -0xcc(%ebp),%eax
c01089b8:	8b 40 20             	mov    0x20(%eax),%eax
c01089bb:	39 c2                	cmp    %eax,%edx
c01089bd:	0f 82 76 ff ff ff    	jb     c0108939 <check_slab+0x3fc>
        assert(!PageSlab(p0));
    }


    v0 = kmalloc(16);
c01089c3:	c7 04 24 10 00 00 00 	movl   $0x10,(%esp)
c01089ca:	e8 66 f7 ff ff       	call   c0108135 <kmalloc>
c01089cf:	89 85 24 ff ff ff    	mov    %eax,-0xdc(%ebp)
    assert(!list_empty(&(cachep0->slabs_notfull)));
c01089d5:	8b 85 34 ff ff ff    	mov    -0xcc(%ebp),%eax
c01089db:	83 c0 08             	add    $0x8,%eax
c01089de:	89 85 7c ff ff ff    	mov    %eax,-0x84(%ebp)
c01089e4:	8b 85 7c ff ff ff    	mov    -0x84(%ebp),%eax
c01089ea:	8b 40 04             	mov    0x4(%eax),%eax
c01089ed:	39 85 7c ff ff ff    	cmp    %eax,-0x84(%ebp)
c01089f3:	0f 94 c0             	sete   %al
c01089f6:	0f b6 c0             	movzbl %al,%eax
c01089f9:	85 c0                	test   %eax,%eax
c01089fb:	74 24                	je     c0108a21 <check_slab+0x4e4>
c01089fd:	c7 44 24 0c 44 c9 10 	movl   $0xc010c944,0xc(%esp)
c0108a04:	c0 
c0108a05:	c7 44 24 08 47 c8 10 	movl   $0xc010c847,0x8(%esp)
c0108a0c:	c0 
c0108a0d:	c7 44 24 04 09 02 00 	movl   $0x209,0x4(%esp)
c0108a14:	00 
c0108a15:	c7 04 24 f6 c7 10 c0 	movl   $0xc010c7f6,(%esp)
c0108a1c:	e8 8f a0 ff ff       	call   c0102ab0 <__panic>
    slabp0 = le2slab(list_next(&(cachep0->slabs_notfull)), slab_link);
c0108a21:	8b 85 34 ff ff ff    	mov    -0xcc(%ebp),%eax
c0108a27:	83 c0 08             	add    $0x8,%eax
c0108a2a:	89 45 80             	mov    %eax,-0x80(%ebp)
 * list_next - get the next entry
 * @listelm:    the list head
 **/
static list_entry_t *
list_next(list_entry_t *listelm) {
    return listelm->next;
c0108a2d:	8b 45 80             	mov    -0x80(%ebp),%eax
c0108a30:	8b 40 04             	mov    0x4(%eax),%eax
c0108a33:	89 85 3c ff ff ff    	mov    %eax,-0xc4(%ebp)

    for (i = 0; i < cachep0->num - 1; i ++) {
c0108a39:	c7 85 20 ff ff ff 00 	movl   $0x0,-0xe0(%ebp)
c0108a40:	00 00 00 
c0108a43:	eb 13                	jmp    c0108a58 <check_slab+0x51b>
        kmalloc(16);
c0108a45:	c7 04 24 10 00 00 00 	movl   $0x10,(%esp)
c0108a4c:	e8 e4 f6 ff ff       	call   c0108135 <kmalloc>

    v0 = kmalloc(16);
    assert(!list_empty(&(cachep0->slabs_notfull)));
    slabp0 = le2slab(list_next(&(cachep0->slabs_notfull)), slab_link);

    for (i = 0; i < cachep0->num - 1; i ++) {
c0108a51:	83 85 20 ff ff ff 01 	addl   $0x1,-0xe0(%ebp)
c0108a58:	8b 95 20 ff ff ff    	mov    -0xe0(%ebp),%edx
c0108a5e:	8b 85 34 ff ff ff    	mov    -0xcc(%ebp),%eax
c0108a64:	8b 40 14             	mov    0x14(%eax),%eax
c0108a67:	83 e8 01             	sub    $0x1,%eax
c0108a6a:	39 c2                	cmp    %eax,%edx
c0108a6c:	72 d7                	jb     c0108a45 <check_slab+0x508>
        kmalloc(16);
    }

    assert(slabp0->inuse == cachep0->num);
c0108a6e:	8b 85 3c ff ff ff    	mov    -0xc4(%ebp),%eax
c0108a74:	8b 50 0c             	mov    0xc(%eax),%edx
c0108a77:	8b 85 34 ff ff ff    	mov    -0xcc(%ebp),%eax
c0108a7d:	8b 40 14             	mov    0x14(%eax),%eax
c0108a80:	39 c2                	cmp    %eax,%edx
c0108a82:	74 24                	je     c0108aa8 <check_slab+0x56b>
c0108a84:	c7 44 24 0c 94 ca 10 	movl   $0xc010ca94,0xc(%esp)
c0108a8b:	c0 
c0108a8c:	c7 44 24 08 47 c8 10 	movl   $0xc010c847,0x8(%esp)
c0108a93:	c0 
c0108a94:	c7 44 24 04 10 02 00 	movl   $0x210,0x4(%esp)
c0108a9b:	00 
c0108a9c:	c7 04 24 f6 c7 10 c0 	movl   $0xc010c7f6,(%esp)
c0108aa3:	e8 08 a0 ff ff       	call   c0102ab0 <__panic>
    assert(list_next(&(cachep0->slabs_full)) == &(slabp0->slab_link));
c0108aa8:	8b 85 34 ff ff ff    	mov    -0xcc(%ebp),%eax
c0108aae:	89 45 84             	mov    %eax,-0x7c(%ebp)
c0108ab1:	8b 45 84             	mov    -0x7c(%ebp),%eax
c0108ab4:	8b 40 04             	mov    0x4(%eax),%eax
c0108ab7:	89 c2                	mov    %eax,%edx
c0108ab9:	8b 85 3c ff ff ff    	mov    -0xc4(%ebp),%eax
c0108abf:	39 c2                	cmp    %eax,%edx
c0108ac1:	74 24                	je     c0108ae7 <check_slab+0x5aa>
c0108ac3:	c7 44 24 0c b4 ca 10 	movl   $0xc010cab4,0xc(%esp)
c0108aca:	c0 
c0108acb:	c7 44 24 08 47 c8 10 	movl   $0xc010c847,0x8(%esp)
c0108ad2:	c0 
c0108ad3:	c7 44 24 04 11 02 00 	movl   $0x211,0x4(%esp)
c0108ada:	00 
c0108adb:	c7 04 24 f6 c7 10 c0 	movl   $0xc010c7f6,(%esp)
c0108ae2:	e8 c9 9f ff ff       	call   c0102ab0 <__panic>
    assert(list_empty(&(cachep0->slabs_notfull)));
c0108ae7:	8b 85 34 ff ff ff    	mov    -0xcc(%ebp),%eax
c0108aed:	83 c0 08             	add    $0x8,%eax
c0108af0:	89 45 88             	mov    %eax,-0x78(%ebp)
 * list_empty - tests whether a list is empty
 * @list:       the list to test.
 * */
static inline bool
list_empty(list_entry_t *list) {
    return list->next == list;
c0108af3:	8b 45 88             	mov    -0x78(%ebp),%eax
c0108af6:	8b 40 04             	mov    0x4(%eax),%eax
c0108af9:	39 45 88             	cmp    %eax,-0x78(%ebp)
c0108afc:	0f 94 c0             	sete   %al
c0108aff:	0f b6 c0             	movzbl %al,%eax
c0108b02:	85 c0                	test   %eax,%eax
c0108b04:	75 24                	jne    c0108b2a <check_slab+0x5ed>
c0108b06:	c7 44 24 0c 60 ca 10 	movl   $0xc010ca60,0xc(%esp)
c0108b0d:	c0 
c0108b0e:	c7 44 24 08 47 c8 10 	movl   $0xc010c847,0x8(%esp)
c0108b15:	c0 
c0108b16:	c7 44 24 04 12 02 00 	movl   $0x212,0x4(%esp)
c0108b1d:	00 
c0108b1e:	c7 04 24 f6 c7 10 c0 	movl   $0xc010c7f6,(%esp)
c0108b25:	e8 86 9f ff ff       	call   c0102ab0 <__panic>

    v1 = kmalloc(16);
c0108b2a:	c7 04 24 10 00 00 00 	movl   $0x10,(%esp)
c0108b31:	e8 ff f5 ff ff       	call   c0108135 <kmalloc>
c0108b36:	89 85 28 ff ff ff    	mov    %eax,-0xd8(%ebp)
    assert(!list_empty(&(cachep0->slabs_notfull)));
c0108b3c:	8b 85 34 ff ff ff    	mov    -0xcc(%ebp),%eax
c0108b42:	83 c0 08             	add    $0x8,%eax
c0108b45:	89 45 8c             	mov    %eax,-0x74(%ebp)
c0108b48:	8b 45 8c             	mov    -0x74(%ebp),%eax
c0108b4b:	8b 40 04             	mov    0x4(%eax),%eax
c0108b4e:	39 45 8c             	cmp    %eax,-0x74(%ebp)
c0108b51:	0f 94 c0             	sete   %al
c0108b54:	0f b6 c0             	movzbl %al,%eax
c0108b57:	85 c0                	test   %eax,%eax
c0108b59:	74 24                	je     c0108b7f <check_slab+0x642>
c0108b5b:	c7 44 24 0c 44 c9 10 	movl   $0xc010c944,0xc(%esp)
c0108b62:	c0 
c0108b63:	c7 44 24 08 47 c8 10 	movl   $0xc010c847,0x8(%esp)
c0108b6a:	c0 
c0108b6b:	c7 44 24 04 15 02 00 	movl   $0x215,0x4(%esp)
c0108b72:	00 
c0108b73:	c7 04 24 f6 c7 10 c0 	movl   $0xc010c7f6,(%esp)
c0108b7a:	e8 31 9f ff ff       	call   c0102ab0 <__panic>
    slabp1 = le2slab(list_next(&(cachep0->slabs_notfull)), slab_link);
c0108b7f:	8b 85 34 ff ff ff    	mov    -0xcc(%ebp),%eax
c0108b85:	83 c0 08             	add    $0x8,%eax
c0108b88:	89 45 90             	mov    %eax,-0x70(%ebp)
 * list_next - get the next entry
 * @listelm:    the list head
 **/
static list_entry_t *
list_next(list_entry_t *listelm) {
    return listelm->next;
c0108b8b:	8b 45 90             	mov    -0x70(%ebp),%eax
c0108b8e:	8b 40 04             	mov    0x4(%eax),%eax
c0108b91:	89 85 40 ff ff ff    	mov    %eax,-0xc0(%ebp)

    kfree(v0);
c0108b97:	8b 85 24 ff ff ff    	mov    -0xdc(%ebp),%eax
c0108b9d:	89 04 24             	mov    %eax,(%esp)
c0108ba0:	e8 bf f8 ff ff       	call   c0108464 <kfree>
    assert(list_empty(&(cachep0->slabs_full)));
c0108ba5:	8b 85 34 ff ff ff    	mov    -0xcc(%ebp),%eax
c0108bab:	89 45 94             	mov    %eax,-0x6c(%ebp)
 * list_empty - tests whether a list is empty
 * @list:       the list to test.
 * */
static inline bool
list_empty(list_entry_t *list) {
    return list->next == list;
c0108bae:	8b 45 94             	mov    -0x6c(%ebp),%eax
c0108bb1:	8b 40 04             	mov    0x4(%eax),%eax
c0108bb4:	39 45 94             	cmp    %eax,-0x6c(%ebp)
c0108bb7:	0f 94 c0             	sete   %al
c0108bba:	0f b6 c0             	movzbl %al,%eax
c0108bbd:	85 c0                	test   %eax,%eax
c0108bbf:	75 24                	jne    c0108be5 <check_slab+0x6a8>
c0108bc1:	c7 44 24 0c f0 ca 10 	movl   $0xc010caf0,0xc(%esp)
c0108bc8:	c0 
c0108bc9:	c7 44 24 08 47 c8 10 	movl   $0xc010c847,0x8(%esp)
c0108bd0:	c0 
c0108bd1:	c7 44 24 04 19 02 00 	movl   $0x219,0x4(%esp)
c0108bd8:	00 
c0108bd9:	c7 04 24 f6 c7 10 c0 	movl   $0xc010c7f6,(%esp)
c0108be0:	e8 cb 9e ff ff       	call   c0102ab0 <__panic>
    assert(list_next(&(slabp0->slab_link)) == &(slabp1->slab_link)
c0108be5:	8b 85 3c ff ff ff    	mov    -0xc4(%ebp),%eax
c0108beb:	89 45 98             	mov    %eax,-0x68(%ebp)
 * list_next - get the next entry
 * @listelm:    the list head
 **/
static list_entry_t *
list_next(list_entry_t *listelm) {
    return listelm->next;
c0108bee:	8b 45 98             	mov    -0x68(%ebp),%eax
c0108bf1:	8b 40 04             	mov    0x4(%eax),%eax
c0108bf4:	89 c2                	mov    %eax,%edx
c0108bf6:	8b 85 40 ff ff ff    	mov    -0xc0(%ebp),%eax
c0108bfc:	39 c2                	cmp    %eax,%edx
c0108bfe:	74 3f                	je     c0108c3f <check_slab+0x702>
c0108c00:	8b 85 40 ff ff ff    	mov    -0xc0(%ebp),%eax
c0108c06:	89 45 9c             	mov    %eax,-0x64(%ebp)
c0108c09:	8b 45 9c             	mov    -0x64(%ebp),%eax
c0108c0c:	8b 40 04             	mov    0x4(%eax),%eax
c0108c0f:	89 c2                	mov    %eax,%edx
c0108c11:	8b 85 3c ff ff ff    	mov    -0xc4(%ebp),%eax
c0108c17:	39 c2                	cmp    %eax,%edx
c0108c19:	74 24                	je     c0108c3f <check_slab+0x702>
c0108c1b:	c7 44 24 0c 14 cb 10 	movl   $0xc010cb14,0xc(%esp)
c0108c22:	c0 
c0108c23:	c7 44 24 08 47 c8 10 	movl   $0xc010c847,0x8(%esp)
c0108c2a:	c0 
c0108c2b:	c7 44 24 04 1b 02 00 	movl   $0x21b,0x4(%esp)
c0108c32:	00 
c0108c33:	c7 04 24 f6 c7 10 c0 	movl   $0xc010c7f6,(%esp)
c0108c3a:	e8 71 9e ff ff       	call   c0102ab0 <__panic>
            || list_next(&(slabp1->slab_link)) == &(slabp0->slab_link));

    kfree(v1);
c0108c3f:	8b 85 28 ff ff ff    	mov    -0xd8(%ebp),%eax
c0108c45:	89 04 24             	mov    %eax,(%esp)
c0108c48:	e8 17 f8 ff ff       	call   c0108464 <kfree>
    assert(!list_empty(&(cachep0->slabs_notfull)));
c0108c4d:	8b 85 34 ff ff ff    	mov    -0xcc(%ebp),%eax
c0108c53:	83 c0 08             	add    $0x8,%eax
c0108c56:	89 45 a0             	mov    %eax,-0x60(%ebp)
 * list_empty - tests whether a list is empty
 * @list:       the list to test.
 * */
static inline bool
list_empty(list_entry_t *list) {
    return list->next == list;
c0108c59:	8b 45 a0             	mov    -0x60(%ebp),%eax
c0108c5c:	8b 40 04             	mov    0x4(%eax),%eax
c0108c5f:	39 45 a0             	cmp    %eax,-0x60(%ebp)
c0108c62:	0f 94 c0             	sete   %al
c0108c65:	0f b6 c0             	movzbl %al,%eax
c0108c68:	85 c0                	test   %eax,%eax
c0108c6a:	74 24                	je     c0108c90 <check_slab+0x753>
c0108c6c:	c7 44 24 0c 44 c9 10 	movl   $0xc010c944,0xc(%esp)
c0108c73:	c0 
c0108c74:	c7 44 24 08 47 c8 10 	movl   $0xc010c847,0x8(%esp)
c0108c7b:	c0 
c0108c7c:	c7 44 24 04 1e 02 00 	movl   $0x21e,0x4(%esp)
c0108c83:	00 
c0108c84:	c7 04 24 f6 c7 10 c0 	movl   $0xc010c7f6,(%esp)
c0108c8b:	e8 20 9e ff ff       	call   c0102ab0 <__panic>
    assert(list_next(&(cachep0->slabs_notfull)) == &(slabp0->slab_link));
c0108c90:	8b 85 34 ff ff ff    	mov    -0xcc(%ebp),%eax
c0108c96:	83 c0 08             	add    $0x8,%eax
c0108c99:	89 45 a4             	mov    %eax,-0x5c(%ebp)
 * list_next - get the next entry
 * @listelm:    the list head
 **/
static list_entry_t *
list_next(list_entry_t *listelm) {
    return listelm->next;
c0108c9c:	8b 45 a4             	mov    -0x5c(%ebp),%eax
c0108c9f:	8b 40 04             	mov    0x4(%eax),%eax
c0108ca2:	89 c2                	mov    %eax,%edx
c0108ca4:	8b 85 3c ff ff ff    	mov    -0xc4(%ebp),%eax
c0108caa:	39 c2                	cmp    %eax,%edx
c0108cac:	74 24                	je     c0108cd2 <check_slab+0x795>
c0108cae:	c7 44 24 0c 88 cb 10 	movl   $0xc010cb88,0xc(%esp)
c0108cb5:	c0 
c0108cb6:	c7 44 24 08 47 c8 10 	movl   $0xc010c847,0x8(%esp)
c0108cbd:	c0 
c0108cbe:	c7 44 24 04 1f 02 00 	movl   $0x21f,0x4(%esp)
c0108cc5:	00 
c0108cc6:	c7 04 24 f6 c7 10 c0 	movl   $0xc010c7f6,(%esp)
c0108ccd:	e8 de 9d ff ff       	call   c0102ab0 <__panic>
    assert(list_next(&(slabp0->slab_link)) == &(cachep0->slabs_notfull));
c0108cd2:	8b 85 3c ff ff ff    	mov    -0xc4(%ebp),%eax
c0108cd8:	89 45 a8             	mov    %eax,-0x58(%ebp)
c0108cdb:	8b 45 a8             	mov    -0x58(%ebp),%eax
c0108cde:	8b 40 04             	mov    0x4(%eax),%eax
c0108ce1:	8b 95 34 ff ff ff    	mov    -0xcc(%ebp),%edx
c0108ce7:	83 c2 08             	add    $0x8,%edx
c0108cea:	39 d0                	cmp    %edx,%eax
c0108cec:	74 24                	je     c0108d12 <check_slab+0x7d5>
c0108cee:	c7 44 24 0c c8 cb 10 	movl   $0xc010cbc8,0xc(%esp)
c0108cf5:	c0 
c0108cf6:	c7 44 24 08 47 c8 10 	movl   $0xc010c847,0x8(%esp)
c0108cfd:	c0 
c0108cfe:	c7 44 24 04 20 02 00 	movl   $0x220,0x4(%esp)
c0108d05:	00 
c0108d06:	c7 04 24 f6 c7 10 c0 	movl   $0xc010c7f6,(%esp)
c0108d0d:	e8 9e 9d ff ff       	call   c0102ab0 <__panic>

    v1 = kmalloc(16);
c0108d12:	c7 04 24 10 00 00 00 	movl   $0x10,(%esp)
c0108d19:	e8 17 f4 ff ff       	call   c0108135 <kmalloc>
c0108d1e:	89 85 28 ff ff ff    	mov    %eax,-0xd8(%ebp)
    assert(v1 == v0);
c0108d24:	8b 85 28 ff ff ff    	mov    -0xd8(%ebp),%eax
c0108d2a:	3b 85 24 ff ff ff    	cmp    -0xdc(%ebp),%eax
c0108d30:	74 24                	je     c0108d56 <check_slab+0x819>
c0108d32:	c7 44 24 0c 05 cc 10 	movl   $0xc010cc05,0xc(%esp)
c0108d39:	c0 
c0108d3a:	c7 44 24 08 47 c8 10 	movl   $0xc010c847,0x8(%esp)
c0108d41:	c0 
c0108d42:	c7 44 24 04 23 02 00 	movl   $0x223,0x4(%esp)
c0108d49:	00 
c0108d4a:	c7 04 24 f6 c7 10 c0 	movl   $0xc010c7f6,(%esp)
c0108d51:	e8 5a 9d ff ff       	call   c0102ab0 <__panic>
    assert(list_next(&(cachep0->slabs_full)) == &(slabp0->slab_link));
c0108d56:	8b 85 34 ff ff ff    	mov    -0xcc(%ebp),%eax
c0108d5c:	89 45 ac             	mov    %eax,-0x54(%ebp)
c0108d5f:	8b 45 ac             	mov    -0x54(%ebp),%eax
c0108d62:	8b 40 04             	mov    0x4(%eax),%eax
c0108d65:	89 c2                	mov    %eax,%edx
c0108d67:	8b 85 3c ff ff ff    	mov    -0xc4(%ebp),%eax
c0108d6d:	39 c2                	cmp    %eax,%edx
c0108d6f:	74 24                	je     c0108d95 <check_slab+0x858>
c0108d71:	c7 44 24 0c b4 ca 10 	movl   $0xc010cab4,0xc(%esp)
c0108d78:	c0 
c0108d79:	c7 44 24 08 47 c8 10 	movl   $0xc010c847,0x8(%esp)
c0108d80:	c0 
c0108d81:	c7 44 24 04 24 02 00 	movl   $0x224,0x4(%esp)
c0108d88:	00 
c0108d89:	c7 04 24 f6 c7 10 c0 	movl   $0xc010c7f6,(%esp)
c0108d90:	e8 1b 9d ff ff       	call   c0102ab0 <__panic>
    assert(list_empty(&(cachep0->slabs_notfull)));
c0108d95:	8b 85 34 ff ff ff    	mov    -0xcc(%ebp),%eax
c0108d9b:	83 c0 08             	add    $0x8,%eax
c0108d9e:	89 45 b0             	mov    %eax,-0x50(%ebp)
 * list_empty - tests whether a list is empty
 * @list:       the list to test.
 * */
static inline bool
list_empty(list_entry_t *list) {
    return list->next == list;
c0108da1:	8b 45 b0             	mov    -0x50(%ebp),%eax
c0108da4:	8b 40 04             	mov    0x4(%eax),%eax
c0108da7:	39 45 b0             	cmp    %eax,-0x50(%ebp)
c0108daa:	0f 94 c0             	sete   %al
c0108dad:	0f b6 c0             	movzbl %al,%eax
c0108db0:	85 c0                	test   %eax,%eax
c0108db2:	75 24                	jne    c0108dd8 <check_slab+0x89b>
c0108db4:	c7 44 24 0c 60 ca 10 	movl   $0xc010ca60,0xc(%esp)
c0108dbb:	c0 
c0108dbc:	c7 44 24 08 47 c8 10 	movl   $0xc010c847,0x8(%esp)
c0108dc3:	c0 
c0108dc4:	c7 44 24 04 25 02 00 	movl   $0x225,0x4(%esp)
c0108dcb:	00 
c0108dcc:	c7 04 24 f6 c7 10 c0 	movl   $0xc010c7f6,(%esp)
c0108dd3:	e8 d8 9c ff ff       	call   c0102ab0 <__panic>

    for (i = 0; i < cachep0->num; i ++) {
c0108dd8:	c7 85 20 ff ff ff 00 	movl   $0x0,-0xe0(%ebp)
c0108ddf:	00 00 00 
c0108de2:	eb 27                	jmp    c0108e0b <check_slab+0x8ce>
        kfree(v1 + i * cachep0->objsize);
c0108de4:	8b 85 34 ff ff ff    	mov    -0xcc(%ebp),%eax
c0108dea:	8b 50 10             	mov    0x10(%eax),%edx
c0108ded:	8b 85 20 ff ff ff    	mov    -0xe0(%ebp),%eax
c0108df3:	0f af c2             	imul   %edx,%eax
c0108df6:	03 85 28 ff ff ff    	add    -0xd8(%ebp),%eax
c0108dfc:	89 04 24             	mov    %eax,(%esp)
c0108dff:	e8 60 f6 ff ff       	call   c0108464 <kfree>
    v1 = kmalloc(16);
    assert(v1 == v0);
    assert(list_next(&(cachep0->slabs_full)) == &(slabp0->slab_link));
    assert(list_empty(&(cachep0->slabs_notfull)));

    for (i = 0; i < cachep0->num; i ++) {
c0108e04:	83 85 20 ff ff ff 01 	addl   $0x1,-0xe0(%ebp)
c0108e0b:	8b 95 20 ff ff ff    	mov    -0xe0(%ebp),%edx
c0108e11:	8b 85 34 ff ff ff    	mov    -0xcc(%ebp),%eax
c0108e17:	8b 40 14             	mov    0x14(%eax),%eax
c0108e1a:	39 c2                	cmp    %eax,%edx
c0108e1c:	72 c6                	jb     c0108de4 <check_slab+0x8a7>
        kfree(v1 + i * cachep0->objsize);
    }

    assert(list_empty(&(cachep0->slabs_full)));
c0108e1e:	8b 85 34 ff ff ff    	mov    -0xcc(%ebp),%eax
c0108e24:	89 45 b4             	mov    %eax,-0x4c(%ebp)
c0108e27:	8b 45 b4             	mov    -0x4c(%ebp),%eax
c0108e2a:	8b 40 04             	mov    0x4(%eax),%eax
c0108e2d:	39 45 b4             	cmp    %eax,-0x4c(%ebp)
c0108e30:	0f 94 c0             	sete   %al
c0108e33:	0f b6 c0             	movzbl %al,%eax
c0108e36:	85 c0                	test   %eax,%eax
c0108e38:	75 24                	jne    c0108e5e <check_slab+0x921>
c0108e3a:	c7 44 24 0c f0 ca 10 	movl   $0xc010caf0,0xc(%esp)
c0108e41:	c0 
c0108e42:	c7 44 24 08 47 c8 10 	movl   $0xc010c847,0x8(%esp)
c0108e49:	c0 
c0108e4a:	c7 44 24 04 2b 02 00 	movl   $0x22b,0x4(%esp)
c0108e51:	00 
c0108e52:	c7 04 24 f6 c7 10 c0 	movl   $0xc010c7f6,(%esp)
c0108e59:	e8 52 9c ff ff       	call   c0102ab0 <__panic>
    assert(list_empty(&(cachep0->slabs_notfull)));
c0108e5e:	8b 85 34 ff ff ff    	mov    -0xcc(%ebp),%eax
c0108e64:	83 c0 08             	add    $0x8,%eax
c0108e67:	89 45 b8             	mov    %eax,-0x48(%ebp)
c0108e6a:	8b 45 b8             	mov    -0x48(%ebp),%eax
c0108e6d:	8b 40 04             	mov    0x4(%eax),%eax
c0108e70:	39 45 b8             	cmp    %eax,-0x48(%ebp)
c0108e73:	0f 94 c0             	sete   %al
c0108e76:	0f b6 c0             	movzbl %al,%eax
c0108e79:	85 c0                	test   %eax,%eax
c0108e7b:	75 24                	jne    c0108ea1 <check_slab+0x964>
c0108e7d:	c7 44 24 0c 60 ca 10 	movl   $0xc010ca60,0xc(%esp)
c0108e84:	c0 
c0108e85:	c7 44 24 08 47 c8 10 	movl   $0xc010c847,0x8(%esp)
c0108e8c:	c0 
c0108e8d:	c7 44 24 04 2c 02 00 	movl   $0x22c,0x4(%esp)
c0108e94:	00 
c0108e95:	c7 04 24 f6 c7 10 c0 	movl   $0xc010c7f6,(%esp)
c0108e9c:	e8 0f 9c ff ff       	call   c0102ab0 <__panic>

    cachep0 = slab_cache;
c0108ea1:	c7 85 34 ff ff ff a0 	movl   $0xc0128aa0,-0xcc(%ebp)
c0108ea8:	8a 12 c0 

    bool has_off_slab = 0;
c0108eab:	c7 85 50 ff ff ff 00 	movl   $0x0,-0xb0(%ebp)
c0108eb2:	00 00 00 
    for (i = 0; i < SLAB_CACHE_NUM; i ++, cachep0 ++) {
c0108eb5:	c7 85 20 ff ff ff 00 	movl   $0x0,-0xe0(%ebp)
c0108ebc:	00 00 00 
c0108ebf:	eb 41                	jmp    c0108f02 <check_slab+0x9c5>
        if (cachep0->off_slab) {
c0108ec1:	8b 85 34 ff ff ff    	mov    -0xcc(%ebp),%eax
c0108ec7:	8b 40 1c             	mov    0x1c(%eax),%eax
c0108eca:	85 c0                	test   %eax,%eax
c0108ecc:	74 26                	je     c0108ef4 <check_slab+0x9b7>
            has_off_slab = 1;
c0108ece:	c7 85 50 ff ff ff 01 	movl   $0x1,-0xb0(%ebp)
c0108ed5:	00 00 00 
            cachep1 = cachep0->slab_cachep;
c0108ed8:	8b 85 34 ff ff ff    	mov    -0xcc(%ebp),%eax
c0108ede:	8b 40 24             	mov    0x24(%eax),%eax
c0108ee1:	89 85 38 ff ff ff    	mov    %eax,-0xc8(%ebp)
            if (!cachep1->off_slab) {
c0108ee7:	8b 85 38 ff ff ff    	mov    -0xc8(%ebp),%eax
c0108eed:	8b 40 1c             	mov    0x1c(%eax),%eax
c0108ef0:	85 c0                	test   %eax,%eax
c0108ef2:	74 19                	je     c0108f0d <check_slab+0x9d0>
    assert(list_empty(&(cachep0->slabs_notfull)));

    cachep0 = slab_cache;

    bool has_off_slab = 0;
    for (i = 0; i < SLAB_CACHE_NUM; i ++, cachep0 ++) {
c0108ef4:	83 85 20 ff ff ff 01 	addl   $0x1,-0xe0(%ebp)
c0108efb:	83 85 34 ff ff ff 28 	addl   $0x28,-0xcc(%ebp)
c0108f02:	83 bd 20 ff ff ff 0c 	cmpl   $0xc,-0xe0(%ebp)
c0108f09:	7e b6                	jle    c0108ec1 <check_slab+0x984>
c0108f0b:	eb 01                	jmp    c0108f0e <check_slab+0x9d1>
        if (cachep0->off_slab) {
            has_off_slab = 1;
            cachep1 = cachep0->slab_cachep;
            if (!cachep1->off_slab) {
                break;
c0108f0d:	90                   	nop
            }
        }
    }

    if (!has_off_slab) {
c0108f0e:	83 bd 50 ff ff ff 00 	cmpl   $0x0,-0xb0(%ebp)
c0108f15:	0f 84 a9 04 00 00    	je     c01093c4 <check_slab+0xe87>
        goto check_pass;
    }

    assert(cachep0->off_slab && !cachep1->off_slab);
c0108f1b:	8b 85 34 ff ff ff    	mov    -0xcc(%ebp),%eax
c0108f21:	8b 40 1c             	mov    0x1c(%eax),%eax
c0108f24:	85 c0                	test   %eax,%eax
c0108f26:	74 0d                	je     c0108f35 <check_slab+0x9f8>
c0108f28:	8b 85 38 ff ff ff    	mov    -0xc8(%ebp),%eax
c0108f2e:	8b 40 1c             	mov    0x1c(%eax),%eax
c0108f31:	85 c0                	test   %eax,%eax
c0108f33:	74 24                	je     c0108f59 <check_slab+0xa1c>
c0108f35:	c7 44 24 0c 10 cc 10 	movl   $0xc010cc10,0xc(%esp)
c0108f3c:	c0 
c0108f3d:	c7 44 24 08 47 c8 10 	movl   $0xc010c847,0x8(%esp)
c0108f44:	c0 
c0108f45:	c7 44 24 04 3f 02 00 	movl   $0x23f,0x4(%esp)
c0108f4c:	00 
c0108f4d:	c7 04 24 f6 c7 10 c0 	movl   $0xc010c7f6,(%esp)
c0108f54:	e8 57 9b ff ff       	call   c0102ab0 <__panic>
    assert(cachep1 < cachep0);
c0108f59:	8b 85 38 ff ff ff    	mov    -0xc8(%ebp),%eax
c0108f5f:	3b 85 34 ff ff ff    	cmp    -0xcc(%ebp),%eax
c0108f65:	72 24                	jb     c0108f8b <check_slab+0xa4e>
c0108f67:	c7 44 24 0c 38 cc 10 	movl   $0xc010cc38,0xc(%esp)
c0108f6e:	c0 
c0108f6f:	c7 44 24 08 47 c8 10 	movl   $0xc010c847,0x8(%esp)
c0108f76:	c0 
c0108f77:	c7 44 24 04 40 02 00 	movl   $0x240,0x4(%esp)
c0108f7e:	00 
c0108f7f:	c7 04 24 f6 c7 10 c0 	movl   $0xc010c7f6,(%esp)
c0108f86:	e8 25 9b ff ff       	call   c0102ab0 <__panic>

    assert(list_empty(&(cachep0->slabs_full)));
c0108f8b:	8b 85 34 ff ff ff    	mov    -0xcc(%ebp),%eax
c0108f91:	89 45 bc             	mov    %eax,-0x44(%ebp)
c0108f94:	8b 45 bc             	mov    -0x44(%ebp),%eax
c0108f97:	8b 40 04             	mov    0x4(%eax),%eax
c0108f9a:	39 45 bc             	cmp    %eax,-0x44(%ebp)
c0108f9d:	0f 94 c0             	sete   %al
c0108fa0:	0f b6 c0             	movzbl %al,%eax
c0108fa3:	85 c0                	test   %eax,%eax
c0108fa5:	75 24                	jne    c0108fcb <check_slab+0xa8e>
c0108fa7:	c7 44 24 0c f0 ca 10 	movl   $0xc010caf0,0xc(%esp)
c0108fae:	c0 
c0108faf:	c7 44 24 08 47 c8 10 	movl   $0xc010c847,0x8(%esp)
c0108fb6:	c0 
c0108fb7:	c7 44 24 04 42 02 00 	movl   $0x242,0x4(%esp)
c0108fbe:	00 
c0108fbf:	c7 04 24 f6 c7 10 c0 	movl   $0xc010c7f6,(%esp)
c0108fc6:	e8 e5 9a ff ff       	call   c0102ab0 <__panic>
    assert(list_empty(&(cachep0->slabs_notfull)));
c0108fcb:	8b 85 34 ff ff ff    	mov    -0xcc(%ebp),%eax
c0108fd1:	83 c0 08             	add    $0x8,%eax
c0108fd4:	89 45 c0             	mov    %eax,-0x40(%ebp)
c0108fd7:	8b 45 c0             	mov    -0x40(%ebp),%eax
c0108fda:	8b 40 04             	mov    0x4(%eax),%eax
c0108fdd:	39 45 c0             	cmp    %eax,-0x40(%ebp)
c0108fe0:	0f 94 c0             	sete   %al
c0108fe3:	0f b6 c0             	movzbl %al,%eax
c0108fe6:	85 c0                	test   %eax,%eax
c0108fe8:	75 24                	jne    c010900e <check_slab+0xad1>
c0108fea:	c7 44 24 0c 60 ca 10 	movl   $0xc010ca60,0xc(%esp)
c0108ff1:	c0 
c0108ff2:	c7 44 24 08 47 c8 10 	movl   $0xc010c847,0x8(%esp)
c0108ff9:	c0 
c0108ffa:	c7 44 24 04 43 02 00 	movl   $0x243,0x4(%esp)
c0109001:	00 
c0109002:	c7 04 24 f6 c7 10 c0 	movl   $0xc010c7f6,(%esp)
c0109009:	e8 a2 9a ff ff       	call   c0102ab0 <__panic>

    assert(list_empty(&(cachep1->slabs_full)));
c010900e:	8b 85 38 ff ff ff    	mov    -0xc8(%ebp),%eax
c0109014:	89 45 c4             	mov    %eax,-0x3c(%ebp)
c0109017:	8b 45 c4             	mov    -0x3c(%ebp),%eax
c010901a:	8b 40 04             	mov    0x4(%eax),%eax
c010901d:	39 45 c4             	cmp    %eax,-0x3c(%ebp)
c0109020:	0f 94 c0             	sete   %al
c0109023:	0f b6 c0             	movzbl %al,%eax
c0109026:	85 c0                	test   %eax,%eax
c0109028:	75 24                	jne    c010904e <check_slab+0xb11>
c010902a:	c7 44 24 0c 4c cc 10 	movl   $0xc010cc4c,0xc(%esp)
c0109031:	c0 
c0109032:	c7 44 24 08 47 c8 10 	movl   $0xc010c847,0x8(%esp)
c0109039:	c0 
c010903a:	c7 44 24 04 45 02 00 	movl   $0x245,0x4(%esp)
c0109041:	00 
c0109042:	c7 04 24 f6 c7 10 c0 	movl   $0xc010c7f6,(%esp)
c0109049:	e8 62 9a ff ff       	call   c0102ab0 <__panic>
    assert(list_empty(&(cachep1->slabs_notfull)));
c010904e:	8b 85 38 ff ff ff    	mov    -0xc8(%ebp),%eax
c0109054:	83 c0 08             	add    $0x8,%eax
c0109057:	89 45 c8             	mov    %eax,-0x38(%ebp)
c010905a:	8b 45 c8             	mov    -0x38(%ebp),%eax
c010905d:	8b 40 04             	mov    0x4(%eax),%eax
c0109060:	39 45 c8             	cmp    %eax,-0x38(%ebp)
c0109063:	0f 94 c0             	sete   %al
c0109066:	0f b6 c0             	movzbl %al,%eax
c0109069:	85 c0                	test   %eax,%eax
c010906b:	75 24                	jne    c0109091 <check_slab+0xb54>
c010906d:	c7 44 24 0c 70 cc 10 	movl   $0xc010cc70,0xc(%esp)
c0109074:	c0 
c0109075:	c7 44 24 08 47 c8 10 	movl   $0xc010c847,0x8(%esp)
c010907c:	c0 
c010907d:	c7 44 24 04 46 02 00 	movl   $0x246,0x4(%esp)
c0109084:	00 
c0109085:	c7 04 24 f6 c7 10 c0 	movl   $0xc010c7f6,(%esp)
c010908c:	e8 1f 9a ff ff       	call   c0102ab0 <__panic>

    v0 = kmalloc(cachep0->objsize);
c0109091:	8b 85 34 ff ff ff    	mov    -0xcc(%ebp),%eax
c0109097:	8b 40 10             	mov    0x10(%eax),%eax
c010909a:	89 04 24             	mov    %eax,(%esp)
c010909d:	e8 93 f0 ff ff       	call   c0108135 <kmalloc>
c01090a2:	89 85 24 ff ff ff    	mov    %eax,-0xdc(%ebp)
    p0 = kva2page(v0);
c01090a8:	8b 85 24 ff ff ff    	mov    -0xdc(%ebp),%eax
c01090ae:	89 04 24             	mov    %eax,(%esp)
c01090b1:	e8 bc e7 ff ff       	call   c0107872 <kva2page>
c01090b6:	89 85 44 ff ff ff    	mov    %eax,-0xbc(%ebp)
    assert(page2kva(p0) == v0);
c01090bc:	8b 85 44 ff ff ff    	mov    -0xbc(%ebp),%eax
c01090c2:	89 04 24             	mov    %eax,(%esp)
c01090c5:	e8 54 e7 ff ff       	call   c010781e <page2kva>
c01090ca:	3b 85 24 ff ff ff    	cmp    -0xdc(%ebp),%eax
c01090d0:	74 24                	je     c01090f6 <check_slab+0xbb9>
c01090d2:	c7 44 24 0c 96 cc 10 	movl   $0xc010cc96,0xc(%esp)
c01090d9:	c0 
c01090da:	c7 44 24 08 47 c8 10 	movl   $0xc010c847,0x8(%esp)
c01090e1:	c0 
c01090e2:	c7 44 24 04 4a 02 00 	movl   $0x24a,0x4(%esp)
c01090e9:	00 
c01090ea:	c7 04 24 f6 c7 10 c0 	movl   $0xc010c7f6,(%esp)
c01090f1:	e8 ba 99 ff ff       	call   c0102ab0 <__panic>

    if (cachep0->num == 1) {
c01090f6:	8b 85 34 ff ff ff    	mov    -0xcc(%ebp),%eax
c01090fc:	8b 40 14             	mov    0x14(%eax),%eax
c01090ff:	83 f8 01             	cmp    $0x1,%eax
c0109102:	75 57                	jne    c010915b <check_slab+0xc1e>
        assert(!list_empty(&(cachep0->slabs_full)));
c0109104:	8b 85 34 ff ff ff    	mov    -0xcc(%ebp),%eax
c010910a:	89 45 cc             	mov    %eax,-0x34(%ebp)
c010910d:	8b 45 cc             	mov    -0x34(%ebp),%eax
c0109110:	8b 40 04             	mov    0x4(%eax),%eax
c0109113:	39 45 cc             	cmp    %eax,-0x34(%ebp)
c0109116:	0f 94 c0             	sete   %al
c0109119:	0f b6 c0             	movzbl %al,%eax
c010911c:	85 c0                	test   %eax,%eax
c010911e:	74 24                	je     c0109144 <check_slab+0xc07>
c0109120:	c7 44 24 0c ac cc 10 	movl   $0xc010ccac,0xc(%esp)
c0109127:	c0 
c0109128:	c7 44 24 08 47 c8 10 	movl   $0xc010c847,0x8(%esp)
c010912f:	c0 
c0109130:	c7 44 24 04 4d 02 00 	movl   $0x24d,0x4(%esp)
c0109137:	00 
c0109138:	c7 04 24 f6 c7 10 c0 	movl   $0xc010c7f6,(%esp)
c010913f:	e8 6c 99 ff ff       	call   c0102ab0 <__panic>
        slabp0 = le2slab(list_next(&(cachep0->slabs_full)), slab_link);
c0109144:	8b 85 34 ff ff ff    	mov    -0xcc(%ebp),%eax
c010914a:	89 45 d0             	mov    %eax,-0x30(%ebp)
 * list_next - get the next entry
 * @listelm:    the list head
 **/
static list_entry_t *
list_next(list_entry_t *listelm) {
    return listelm->next;
c010914d:	8b 45 d0             	mov    -0x30(%ebp),%eax
c0109150:	8b 40 04             	mov    0x4(%eax),%eax
c0109153:	89 85 3c ff ff ff    	mov    %eax,-0xc4(%ebp)
c0109159:	eb 5b                	jmp    c01091b6 <check_slab+0xc79>
    }
    else {
        assert(!list_empty(&(cachep0->slabs_notfull)));
c010915b:	8b 85 34 ff ff ff    	mov    -0xcc(%ebp),%eax
c0109161:	83 c0 08             	add    $0x8,%eax
c0109164:	89 45 d4             	mov    %eax,-0x2c(%ebp)
 * list_empty - tests whether a list is empty
 * @list:       the list to test.
 * */
static inline bool
list_empty(list_entry_t *list) {
    return list->next == list;
c0109167:	8b 45 d4             	mov    -0x2c(%ebp),%eax
c010916a:	8b 40 04             	mov    0x4(%eax),%eax
c010916d:	39 45 d4             	cmp    %eax,-0x2c(%ebp)
c0109170:	0f 94 c0             	sete   %al
c0109173:	0f b6 c0             	movzbl %al,%eax
c0109176:	85 c0                	test   %eax,%eax
c0109178:	74 24                	je     c010919e <check_slab+0xc61>
c010917a:	c7 44 24 0c 44 c9 10 	movl   $0xc010c944,0xc(%esp)
c0109181:	c0 
c0109182:	c7 44 24 08 47 c8 10 	movl   $0xc010c847,0x8(%esp)
c0109189:	c0 
c010918a:	c7 44 24 04 51 02 00 	movl   $0x251,0x4(%esp)
c0109191:	00 
c0109192:	c7 04 24 f6 c7 10 c0 	movl   $0xc010c7f6,(%esp)
c0109199:	e8 12 99 ff ff       	call   c0102ab0 <__panic>
        slabp0 = le2slab(list_next(&(cachep0->slabs_notfull)), slab_link);
c010919e:	8b 85 34 ff ff ff    	mov    -0xcc(%ebp),%eax
c01091a4:	83 c0 08             	add    $0x8,%eax
c01091a7:	89 45 d8             	mov    %eax,-0x28(%ebp)
 * list_next - get the next entry
 * @listelm:    the list head
 **/
static list_entry_t *
list_next(list_entry_t *listelm) {
    return listelm->next;
c01091aa:	8b 45 d8             	mov    -0x28(%ebp),%eax
c01091ad:	8b 40 04             	mov    0x4(%eax),%eax
c01091b0:	89 85 3c ff ff ff    	mov    %eax,-0xc4(%ebp)
    }

    assert(slabp0 != NULL);
c01091b6:	83 bd 3c ff ff ff 00 	cmpl   $0x0,-0xc4(%ebp)
c01091bd:	75 24                	jne    c01091e3 <check_slab+0xca6>
c01091bf:	c7 44 24 0c d0 cc 10 	movl   $0xc010ccd0,0xc(%esp)
c01091c6:	c0 
c01091c7:	c7 44 24 08 47 c8 10 	movl   $0xc010c847,0x8(%esp)
c01091ce:	c0 
c01091cf:	c7 44 24 04 55 02 00 	movl   $0x255,0x4(%esp)
c01091d6:	00 
c01091d7:	c7 04 24 f6 c7 10 c0 	movl   $0xc010c7f6,(%esp)
c01091de:	e8 cd 98 ff ff       	call   c0102ab0 <__panic>

    if (cachep1->num == 1) {
c01091e3:	8b 85 38 ff ff ff    	mov    -0xc8(%ebp),%eax
c01091e9:	8b 40 14             	mov    0x14(%eax),%eax
c01091ec:	83 f8 01             	cmp    $0x1,%eax
c01091ef:	75 57                	jne    c0109248 <check_slab+0xd0b>
        assert(!list_empty(&(cachep1->slabs_full)));
c01091f1:	8b 85 38 ff ff ff    	mov    -0xc8(%ebp),%eax
c01091f7:	89 45 dc             	mov    %eax,-0x24(%ebp)
 * list_empty - tests whether a list is empty
 * @list:       the list to test.
 * */
static inline bool
list_empty(list_entry_t *list) {
    return list->next == list;
c01091fa:	8b 45 dc             	mov    -0x24(%ebp),%eax
c01091fd:	8b 40 04             	mov    0x4(%eax),%eax
c0109200:	39 45 dc             	cmp    %eax,-0x24(%ebp)
c0109203:	0f 94 c0             	sete   %al
c0109206:	0f b6 c0             	movzbl %al,%eax
c0109209:	85 c0                	test   %eax,%eax
c010920b:	74 24                	je     c0109231 <check_slab+0xcf4>
c010920d:	c7 44 24 0c e0 cc 10 	movl   $0xc010cce0,0xc(%esp)
c0109214:	c0 
c0109215:	c7 44 24 08 47 c8 10 	movl   $0xc010c847,0x8(%esp)
c010921c:	c0 
c010921d:	c7 44 24 04 58 02 00 	movl   $0x258,0x4(%esp)
c0109224:	00 
c0109225:	c7 04 24 f6 c7 10 c0 	movl   $0xc010c7f6,(%esp)
c010922c:	e8 7f 98 ff ff       	call   c0102ab0 <__panic>
        slabp1 = le2slab(list_next(&(cachep1->slabs_full)), slab_link);
c0109231:	8b 85 38 ff ff ff    	mov    -0xc8(%ebp),%eax
c0109237:	89 45 e0             	mov    %eax,-0x20(%ebp)
 * list_next - get the next entry
 * @listelm:    the list head
 **/
static list_entry_t *
list_next(list_entry_t *listelm) {
    return listelm->next;
c010923a:	8b 45 e0             	mov    -0x20(%ebp),%eax
c010923d:	8b 40 04             	mov    0x4(%eax),%eax
c0109240:	89 85 40 ff ff ff    	mov    %eax,-0xc0(%ebp)
c0109246:	eb 5b                	jmp    c01092a3 <check_slab+0xd66>
    }
    else {
        assert(!list_empty(&(cachep1->slabs_notfull)));
c0109248:	8b 85 38 ff ff ff    	mov    -0xc8(%ebp),%eax
c010924e:	83 c0 08             	add    $0x8,%eax
c0109251:	89 45 e4             	mov    %eax,-0x1c(%ebp)
 * list_empty - tests whether a list is empty
 * @list:       the list to test.
 * */
static inline bool
list_empty(list_entry_t *list) {
    return list->next == list;
c0109254:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0109257:	8b 40 04             	mov    0x4(%eax),%eax
c010925a:	39 45 e4             	cmp    %eax,-0x1c(%ebp)
c010925d:	0f 94 c0             	sete   %al
c0109260:	0f b6 c0             	movzbl %al,%eax
c0109263:	85 c0                	test   %eax,%eax
c0109265:	74 24                	je     c010928b <check_slab+0xd4e>
c0109267:	c7 44 24 0c 04 cd 10 	movl   $0xc010cd04,0xc(%esp)
c010926e:	c0 
c010926f:	c7 44 24 08 47 c8 10 	movl   $0xc010c847,0x8(%esp)
c0109276:	c0 
c0109277:	c7 44 24 04 5c 02 00 	movl   $0x25c,0x4(%esp)
c010927e:	00 
c010927f:	c7 04 24 f6 c7 10 c0 	movl   $0xc010c7f6,(%esp)
c0109286:	e8 25 98 ff ff       	call   c0102ab0 <__panic>
        slabp1 = le2slab(list_next(&(cachep1->slabs_notfull)), slab_link);
c010928b:	8b 85 38 ff ff ff    	mov    -0xc8(%ebp),%eax
c0109291:	83 c0 08             	add    $0x8,%eax
c0109294:	89 45 e8             	mov    %eax,-0x18(%ebp)
 * list_next - get the next entry
 * @listelm:    the list head
 **/
static list_entry_t *
list_next(list_entry_t *listelm) {
    return listelm->next;
c0109297:	8b 45 e8             	mov    -0x18(%ebp),%eax
c010929a:	8b 40 04             	mov    0x4(%eax),%eax
c010929d:	89 85 40 ff ff ff    	mov    %eax,-0xc0(%ebp)
    }

    assert(slabp1 != NULL);
c01092a3:	83 bd 40 ff ff ff 00 	cmpl   $0x0,-0xc0(%ebp)
c01092aa:	75 24                	jne    c01092d0 <check_slab+0xd93>
c01092ac:	c7 44 24 0c 2b cd 10 	movl   $0xc010cd2b,0xc(%esp)
c01092b3:	c0 
c01092b4:	c7 44 24 08 47 c8 10 	movl   $0xc010c847,0x8(%esp)
c01092bb:	c0 
c01092bc:	c7 44 24 04 60 02 00 	movl   $0x260,0x4(%esp)
c01092c3:	00 
c01092c4:	c7 04 24 f6 c7 10 c0 	movl   $0xc010c7f6,(%esp)
c01092cb:	e8 e0 97 ff ff       	call   c0102ab0 <__panic>

    order_size = (1 << cachep0->page_order);
c01092d0:	8b 85 34 ff ff ff    	mov    -0xcc(%ebp),%eax
c01092d6:	8b 40 20             	mov    0x20(%eax),%eax
c01092d9:	ba 01 00 00 00       	mov    $0x1,%edx
c01092de:	89 d3                	mov    %edx,%ebx
c01092e0:	89 c1                	mov    %eax,%ecx
c01092e2:	d3 e3                	shl    %cl,%ebx
c01092e4:	89 d8                	mov    %ebx,%eax
c01092e6:	89 85 4c ff ff ff    	mov    %eax,-0xb4(%ebp)
    for (i = 0; i < order_size; i ++, p0 ++) {
c01092ec:	c7 85 20 ff ff ff 00 	movl   $0x0,-0xe0(%ebp)
c01092f3:	00 00 00 
c01092f6:	e9 a7 00 00 00       	jmp    c01093a2 <check_slab+0xe65>
        assert(PageSlab(p0));
c01092fb:	8b 85 44 ff ff ff    	mov    -0xbc(%ebp),%eax
c0109301:	83 c0 04             	add    $0x4,%eax
c0109304:	c7 45 f0 02 00 00 00 	movl   $0x2,-0x10(%ebp)
c010930b:	89 45 ec             	mov    %eax,-0x14(%ebp)
 * @addr:   the address to count from
 * */
static inline bool
test_bit(int nr, volatile void *addr) {
    int oldbit;
    asm volatile ("btl %2, %1; sbbl %0,%0" : "=r" (oldbit) : "m" (*(volatile long *)addr), "Ir" (nr));
c010930e:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0109311:	8b 55 f0             	mov    -0x10(%ebp),%edx
c0109314:	0f a3 10             	bt     %edx,(%eax)
c0109317:	19 c0                	sbb    %eax,%eax
c0109319:	89 45 f4             	mov    %eax,-0xc(%ebp)
    return oldbit != 0;
c010931c:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c0109320:	0f 95 c0             	setne  %al
c0109323:	0f b6 c0             	movzbl %al,%eax
c0109326:	85 c0                	test   %eax,%eax
c0109328:	75 24                	jne    c010934e <check_slab+0xe11>
c010932a:	c7 44 24 0c 3a cd 10 	movl   $0xc010cd3a,0xc(%esp)
c0109331:	c0 
c0109332:	c7 44 24 08 47 c8 10 	movl   $0xc010c847,0x8(%esp)
c0109339:	c0 
c010933a:	c7 44 24 04 64 02 00 	movl   $0x264,0x4(%esp)
c0109341:	00 
c0109342:	c7 04 24 f6 c7 10 c0 	movl   $0xc010c7f6,(%esp)
c0109349:	e8 62 97 ff ff       	call   c0102ab0 <__panic>
        assert(GET_PAGE_CACHE(p0) == cachep0 && GET_PAGE_SLAB(p0) == slabp0);
c010934e:	8b 85 44 ff ff ff    	mov    -0xbc(%ebp),%eax
c0109354:	8b 40 14             	mov    0x14(%eax),%eax
c0109357:	3b 85 34 ff ff ff    	cmp    -0xcc(%ebp),%eax
c010935d:	75 11                	jne    c0109370 <check_slab+0xe33>
c010935f:	8b 85 44 ff ff ff    	mov    -0xbc(%ebp),%eax
c0109365:	8b 40 10             	mov    0x10(%eax),%eax
c0109368:	3b 85 3c ff ff ff    	cmp    -0xc4(%ebp),%eax
c010936e:	74 24                	je     c0109394 <check_slab+0xe57>
c0109370:	c7 44 24 0c 48 cd 10 	movl   $0xc010cd48,0xc(%esp)
c0109377:	c0 
c0109378:	c7 44 24 08 47 c8 10 	movl   $0xc010c847,0x8(%esp)
c010937f:	c0 
c0109380:	c7 44 24 04 65 02 00 	movl   $0x265,0x4(%esp)
c0109387:	00 
c0109388:	c7 04 24 f6 c7 10 c0 	movl   $0xc010c7f6,(%esp)
c010938f:	e8 1c 97 ff ff       	call   c0102ab0 <__panic>
    }

    assert(slabp1 != NULL);

    order_size = (1 << cachep0->page_order);
    for (i = 0; i < order_size; i ++, p0 ++) {
c0109394:	83 85 20 ff ff ff 01 	addl   $0x1,-0xe0(%ebp)
c010939b:	83 85 44 ff ff ff 18 	addl   $0x18,-0xbc(%ebp)
c01093a2:	8b 85 20 ff ff ff    	mov    -0xe0(%ebp),%eax
c01093a8:	3b 85 4c ff ff ff    	cmp    -0xb4(%ebp),%eax
c01093ae:	0f 82 47 ff ff ff    	jb     c01092fb <check_slab+0xdbe>
        assert(PageSlab(p0));
        assert(GET_PAGE_CACHE(p0) == cachep0 && GET_PAGE_SLAB(p0) == slabp0);
    }

    kfree(v0);
c01093b4:	8b 85 24 ff ff ff    	mov    -0xdc(%ebp),%eax
c01093ba:	89 04 24             	mov    %eax,(%esp)
c01093bd:	e8 a2 f0 ff ff       	call   c0108464 <kfree>
c01093c2:	eb 01                	jmp    c01093c5 <check_slab+0xe88>
            }
        }
    }

    if (!has_off_slab) {
        goto check_pass;
c01093c4:	90                   	nop

    kfree(v0);

check_pass:

    check_rb_tree();
c01093c5:	e8 25 7b ff ff       	call   c0100eef <check_rb_tree>
    check_slab_empty();
c01093ca:	e8 ba f0 ff ff       	call   c0108489 <check_slab_empty>
    assert(slab_allocated() == 0);
c01093cf:	e8 4f e5 ff ff       	call   c0107923 <slab_allocated>
c01093d4:	85 c0                	test   %eax,%eax
c01093d6:	74 24                	je     c01093fc <check_slab+0xebf>
c01093d8:	c7 44 24 0c d1 c8 10 	movl   $0xc010c8d1,0xc(%esp)
c01093df:	c0 
c01093e0:	c7 44 24 08 47 c8 10 	movl   $0xc010c847,0x8(%esp)
c01093e7:	c0 
c01093e8:	c7 44 24 04 6e 02 00 	movl   $0x26e,0x4(%esp)
c01093ef:	00 
c01093f0:	c7 04 24 f6 c7 10 c0 	movl   $0xc010c7f6,(%esp)
c01093f7:	e8 b4 96 ff ff       	call   c0102ab0 <__panic>
    assert(nr_free_pages_store == nr_free_pages());
c01093fc:	e8 30 cc ff ff       	call   c0106031 <nr_free_pages>
c0109401:	3b 85 2c ff ff ff    	cmp    -0xd4(%ebp),%eax
c0109407:	74 24                	je     c010942d <check_slab+0xef0>
c0109409:	c7 44 24 0c 88 cd 10 	movl   $0xc010cd88,0xc(%esp)
c0109410:	c0 
c0109411:	c7 44 24 08 47 c8 10 	movl   $0xc010c847,0x8(%esp)
c0109418:	c0 
c0109419:	c7 44 24 04 6f 02 00 	movl   $0x26f,0x4(%esp)
c0109420:	00 
c0109421:	c7 04 24 f6 c7 10 c0 	movl   $0xc010c7f6,(%esp)
c0109428:	e8 83 96 ff ff       	call   c0102ab0 <__panic>
    assert(slab_allocated_store == slab_allocated());
c010942d:	e8 f1 e4 ff ff       	call   c0107923 <slab_allocated>
c0109432:	3b 85 30 ff ff ff    	cmp    -0xd0(%ebp),%eax
c0109438:	74 24                	je     c010945e <check_slab+0xf21>
c010943a:	c7 44 24 0c b0 cd 10 	movl   $0xc010cdb0,0xc(%esp)
c0109441:	c0 
c0109442:	c7 44 24 08 47 c8 10 	movl   $0xc010c847,0x8(%esp)
c0109449:	c0 
c010944a:	c7 44 24 04 70 02 00 	movl   $0x270,0x4(%esp)
c0109451:	00 
c0109452:	c7 04 24 f6 c7 10 c0 	movl   $0xc010c7f6,(%esp)
c0109459:	e8 52 96 ff ff       	call   c0102ab0 <__panic>

    cprintf("check_slab() succeeded!\n");
c010945e:	c7 04 24 d9 cd 10 c0 	movl   $0xc010cdd9,(%esp)
c0109465:	e8 62 81 ff ff       	call   c01015cc <cprintf>
}
c010946a:	81 c4 f4 00 00 00    	add    $0xf4,%esp
c0109470:	5b                   	pop    %ebx
c0109471:	5d                   	pop    %ebp
c0109472:	c3                   	ret    
	...

c0109474 <pa2page>:
page2pa(struct Page *page) {
    return page2ppn(page) << PGSHIFT;
}

static inline struct Page *
pa2page(uintptr_t pa) {
c0109474:	55                   	push   %ebp
c0109475:	89 e5                	mov    %esp,%ebp
c0109477:	83 ec 18             	sub    $0x18,%esp
    if (PPN(pa) >= npage) {
c010947a:	8b 45 08             	mov    0x8(%ebp),%eax
c010947d:	89 c2                	mov    %eax,%edx
c010947f:	c1 ea 0c             	shr    $0xc,%edx
c0109482:	a1 00 8a 12 c0       	mov    0xc0128a00,%eax
c0109487:	39 c2                	cmp    %eax,%edx
c0109489:	72 1c                	jb     c01094a7 <pa2page+0x33>
        panic("pa2page called with invalid pa");
c010948b:	c7 44 24 08 f4 cd 10 	movl   $0xc010cdf4,0x8(%esp)
c0109492:	c0 
c0109493:	c7 44 24 04 5b 00 00 	movl   $0x5b,0x4(%esp)
c010949a:	00 
c010949b:	c7 04 24 13 ce 10 c0 	movl   $0xc010ce13,(%esp)
c01094a2:	e8 09 96 ff ff       	call   c0102ab0 <__panic>
    }
    return &pages[PPN(pa)];
c01094a7:	8b 0d b4 8c 12 c0    	mov    0xc0128cb4,%ecx
c01094ad:	8b 45 08             	mov    0x8(%ebp),%eax
c01094b0:	89 c2                	mov    %eax,%edx
c01094b2:	c1 ea 0c             	shr    $0xc,%edx
c01094b5:	89 d0                	mov    %edx,%eax
c01094b7:	01 c0                	add    %eax,%eax
c01094b9:	01 d0                	add    %edx,%eax
c01094bb:	c1 e0 03             	shl    $0x3,%eax
c01094be:	8d 04 01             	lea    (%ecx,%eax,1),%eax
}
c01094c1:	c9                   	leave  
c01094c2:	c3                   	ret    

c01094c3 <mm_create>:
static void check_vma_struct(void);
static void check_pgfault(void);

// mm_create -  alloc a mm_struct & initialize it.
struct mm_struct *
mm_create(void) {
c01094c3:	55                   	push   %ebp
c01094c4:	89 e5                	mov    %esp,%ebp
c01094c6:	83 ec 28             	sub    $0x28,%esp
    struct mm_struct *mm = kmalloc(sizeof(struct mm_struct));
c01094c9:	c7 04 24 18 00 00 00 	movl   $0x18,(%esp)
c01094d0:	e8 60 ec ff ff       	call   c0108135 <kmalloc>
c01094d5:	89 45 f0             	mov    %eax,-0x10(%ebp)
    if (mm != NULL) {
c01094d8:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
c01094dc:	74 42                	je     c0109520 <mm_create+0x5d>
        list_init(&(mm->mmap_list));
c01094de:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01094e1:	89 45 f4             	mov    %eax,-0xc(%ebp)
 * list_init - initialize a new entry
 * @elm:        new entry to be initialized
 * */
static inline void
list_init(list_entry_t *elm) {
    elm->prev = elm->next = elm;
c01094e4:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01094e7:	8b 55 f4             	mov    -0xc(%ebp),%edx
c01094ea:	89 50 04             	mov    %edx,0x4(%eax)
c01094ed:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01094f0:	8b 50 04             	mov    0x4(%eax),%edx
c01094f3:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01094f6:	89 10                	mov    %edx,(%eax)
        mm->mmap_tree = NULL;
c01094f8:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01094fb:	c7 40 08 00 00 00 00 	movl   $0x0,0x8(%eax)
        mm->mmap_cache = NULL;
c0109502:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0109505:	c7 40 0c 00 00 00 00 	movl   $0x0,0xc(%eax)
        mm->pgdir = NULL;
c010950c:	8b 45 f0             	mov    -0x10(%ebp),%eax
c010950f:	c7 40 10 00 00 00 00 	movl   $0x0,0x10(%eax)
        mm->map_count = 0;
c0109516:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0109519:	c7 40 14 00 00 00 00 	movl   $0x0,0x14(%eax)
    }
    return mm;
c0109520:	8b 45 f0             	mov    -0x10(%ebp),%eax
}
c0109523:	c9                   	leave  
c0109524:	c3                   	ret    

c0109525 <vma_create>:

// vma_create - alloc a vma_struct & initialize it. (addr range: vm_start~vm_end)
struct vma_struct *
vma_create(uintptr_t vm_start, uintptr_t vm_end, uint32_t vm_flags) {
c0109525:	55                   	push   %ebp
c0109526:	89 e5                	mov    %esp,%ebp
c0109528:	83 ec 28             	sub    $0x28,%esp
    struct vma_struct *vma = kmalloc(sizeof(struct vma_struct));
c010952b:	c7 04 24 28 00 00 00 	movl   $0x28,(%esp)
c0109532:	e8 fe eb ff ff       	call   c0108135 <kmalloc>
c0109537:	89 45 f4             	mov    %eax,-0xc(%ebp)
    if (vma != NULL) {
c010953a:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c010953e:	74 1b                	je     c010955b <vma_create+0x36>
        vma->vm_start = vm_start;
c0109540:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0109543:	8b 55 08             	mov    0x8(%ebp),%edx
c0109546:	89 50 04             	mov    %edx,0x4(%eax)
        vma->vm_end = vm_end;
c0109549:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010954c:	8b 55 0c             	mov    0xc(%ebp),%edx
c010954f:	89 50 08             	mov    %edx,0x8(%eax)
        vma->vm_flags = vm_flags;
c0109552:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0109555:	8b 55 10             	mov    0x10(%ebp),%edx
c0109558:	89 50 0c             	mov    %edx,0xc(%eax)
    }
    return vma;
c010955b:	8b 45 f4             	mov    -0xc(%ebp),%eax
}
c010955e:	c9                   	leave  
c010955f:	c3                   	ret    

c0109560 <find_vma_rb>:

// find_vma_rb - find a vma  (vma->vm_start <= addr <= vma_vm_end) in rb tree
static inline struct vma_struct *
find_vma_rb(rb_tree *tree, uintptr_t addr) {
c0109560:	55                   	push   %ebp
c0109561:	89 e5                	mov    %esp,%ebp
c0109563:	83 ec 28             	sub    $0x28,%esp
    rb_node *node = rb_node_root(tree);
c0109566:	8b 45 08             	mov    0x8(%ebp),%eax
c0109569:	89 04 24             	mov    %eax,(%esp)
c010956c:	e8 96 76 ff ff       	call   c0100c07 <rb_node_root>
c0109571:	89 45 ec             	mov    %eax,-0x14(%ebp)
    struct vma_struct *vma = NULL, *tmp;
c0109574:	c7 45 f0 00 00 00 00 	movl   $0x0,-0x10(%ebp)
    while (node != NULL) {
c010957b:	eb 51                	jmp    c01095ce <find_vma_rb+0x6e>
        tmp = rbn2vma(node, rb_link);
c010957d:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0109580:	83 e8 10             	sub    $0x10,%eax
c0109583:	89 45 f4             	mov    %eax,-0xc(%ebp)
        if (tmp->vm_end > addr) {
c0109586:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0109589:	8b 40 08             	mov    0x8(%eax),%eax
c010958c:	3b 45 0c             	cmp    0xc(%ebp),%eax
c010958f:	76 28                	jbe    c01095b9 <find_vma_rb+0x59>
            vma = tmp;
c0109591:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0109594:	89 45 f0             	mov    %eax,-0x10(%ebp)
            if (tmp->vm_start <= addr) {
c0109597:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010959a:	8b 40 04             	mov    0x4(%eax),%eax
c010959d:	3b 45 0c             	cmp    0xc(%ebp),%eax
c01095a0:	76 34                	jbe    c01095d6 <find_vma_rb+0x76>
                break;
            }
            node = rb_node_left(tree, node);
c01095a2:	8b 45 ec             	mov    -0x14(%ebp),%eax
c01095a5:	89 44 24 04          	mov    %eax,0x4(%esp)
c01095a9:	8b 45 08             	mov    0x8(%ebp),%eax
c01095ac:	89 04 24             	mov    %eax,(%esp)
c01095af:	e8 7c 76 ff ff       	call   c0100c30 <rb_node_left>
c01095b4:	89 45 ec             	mov    %eax,-0x14(%ebp)
c01095b7:	eb 15                	jmp    c01095ce <find_vma_rb+0x6e>
        }
        else {
            node = rb_node_right(tree, node);
c01095b9:	8b 45 ec             	mov    -0x14(%ebp),%eax
c01095bc:	89 44 24 04          	mov    %eax,0x4(%esp)
c01095c0:	8b 45 08             	mov    0x8(%ebp),%eax
c01095c3:	89 04 24             	mov    %eax,(%esp)
c01095c6:	e8 8b 76 ff ff       	call   c0100c56 <rb_node_right>
c01095cb:	89 45 ec             	mov    %eax,-0x14(%ebp)
// find_vma_rb - find a vma  (vma->vm_start <= addr <= vma_vm_end) in rb tree
static inline struct vma_struct *
find_vma_rb(rb_tree *tree, uintptr_t addr) {
    rb_node *node = rb_node_root(tree);
    struct vma_struct *vma = NULL, *tmp;
    while (node != NULL) {
c01095ce:	83 7d ec 00          	cmpl   $0x0,-0x14(%ebp)
c01095d2:	75 a9                	jne    c010957d <find_vma_rb+0x1d>
c01095d4:	eb 01                	jmp    c01095d7 <find_vma_rb+0x77>
        tmp = rbn2vma(node, rb_link);
        if (tmp->vm_end > addr) {
            vma = tmp;
            if (tmp->vm_start <= addr) {
                break;
c01095d6:	90                   	nop
        }
        else {
            node = rb_node_right(tree, node);
        }
    }
    return vma;
c01095d7:	8b 45 f0             	mov    -0x10(%ebp),%eax
}
c01095da:	c9                   	leave  
c01095db:	c3                   	ret    

c01095dc <find_vma>:

// find_vma - find a vma  (vma->vm_start <= addr <= vma_vm_end)
struct vma_struct *
find_vma(struct mm_struct *mm, uintptr_t addr) {
c01095dc:	55                   	push   %ebp
c01095dd:	89 e5                	mov    %esp,%ebp
c01095df:	83 ec 38             	sub    $0x38,%esp
    struct vma_struct *vma = NULL;
c01095e2:	c7 45 e4 00 00 00 00 	movl   $0x0,-0x1c(%ebp)
    if (mm != NULL) {
c01095e9:	83 7d 08 00          	cmpl   $0x0,0x8(%ebp)
c01095ed:	0f 84 ae 00 00 00    	je     c01096a1 <find_vma+0xc5>
        vma = mm->mmap_cache;
c01095f3:	8b 45 08             	mov    0x8(%ebp),%eax
c01095f6:	8b 40 0c             	mov    0xc(%eax),%eax
c01095f9:	89 45 e4             	mov    %eax,-0x1c(%ebp)
        if (!(vma != NULL && vma->vm_start <= addr && vma->vm_end > addr)) {
c01095fc:	83 7d e4 00          	cmpl   $0x0,-0x1c(%ebp)
c0109600:	74 16                	je     c0109618 <find_vma+0x3c>
c0109602:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0109605:	8b 40 04             	mov    0x4(%eax),%eax
c0109608:	3b 45 0c             	cmp    0xc(%ebp),%eax
c010960b:	77 0b                	ja     c0109618 <find_vma+0x3c>
c010960d:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0109610:	8b 40 08             	mov    0x8(%eax),%eax
c0109613:	3b 45 0c             	cmp    0xc(%ebp),%eax
c0109616:	77 7a                	ja     c0109692 <find_vma+0xb6>
            if (mm->mmap_tree != NULL) {
c0109618:	8b 45 08             	mov    0x8(%ebp),%eax
c010961b:	8b 40 08             	mov    0x8(%eax),%eax
c010961e:	85 c0                	test   %eax,%eax
c0109620:	74 1a                	je     c010963c <find_vma+0x60>
                vma = find_vma_rb(mm->mmap_tree, addr);
c0109622:	8b 45 08             	mov    0x8(%ebp),%eax
c0109625:	8b 40 08             	mov    0x8(%eax),%eax
c0109628:	8b 55 0c             	mov    0xc(%ebp),%edx
c010962b:	89 54 24 04          	mov    %edx,0x4(%esp)
c010962f:	89 04 24             	mov    %eax,(%esp)
c0109632:	e8 29 ff ff ff       	call   c0109560 <find_vma_rb>
c0109637:	89 45 e4             	mov    %eax,-0x1c(%ebp)
c010963a:	eb 56                	jmp    c0109692 <find_vma+0xb6>
            }
            else {
                bool found = 0;
c010963c:	c7 45 e8 00 00 00 00 	movl   $0x0,-0x18(%ebp)
                list_entry_t *list = &(mm->mmap_list), *le = list;
c0109643:	8b 45 08             	mov    0x8(%ebp),%eax
c0109646:	89 45 ec             	mov    %eax,-0x14(%ebp)
c0109649:	8b 45 ec             	mov    -0x14(%ebp),%eax
c010964c:	89 45 f0             	mov    %eax,-0x10(%ebp)
                while ((le = list_next(le)) != list) {
c010964f:	eb 1d                	jmp    c010966e <find_vma+0x92>
                    vma = le2vma(le, list_link);
c0109651:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0109654:	83 e8 20             	sub    $0x20,%eax
c0109657:	89 45 e4             	mov    %eax,-0x1c(%ebp)
                    if (addr < vma->vm_end) {
c010965a:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c010965d:	8b 40 08             	mov    0x8(%eax),%eax
c0109660:	3b 45 0c             	cmp    0xc(%ebp),%eax
c0109663:	76 09                	jbe    c010966e <find_vma+0x92>
                        found = 1;
c0109665:	c7 45 e8 01 00 00 00 	movl   $0x1,-0x18(%ebp)
                        break;
c010966c:	eb 17                	jmp    c0109685 <find_vma+0xa9>
c010966e:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0109671:	89 45 f4             	mov    %eax,-0xc(%ebp)
 * list_next - get the next entry
 * @listelm:    the list head
 **/
static list_entry_t *
list_next(list_entry_t *listelm) {
    return listelm->next;
c0109674:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0109677:	8b 40 04             	mov    0x4(%eax),%eax
                vma = find_vma_rb(mm->mmap_tree, addr);
            }
            else {
                bool found = 0;
                list_entry_t *list = &(mm->mmap_list), *le = list;
                while ((le = list_next(le)) != list) {
c010967a:	89 45 f0             	mov    %eax,-0x10(%ebp)
c010967d:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0109680:	3b 45 ec             	cmp    -0x14(%ebp),%eax
c0109683:	75 cc                	jne    c0109651 <find_vma+0x75>
                    if (addr < vma->vm_end) {
                        found = 1;
                        break;
                    }
                }
                if (!found) {
c0109685:	83 7d e8 00          	cmpl   $0x0,-0x18(%ebp)
c0109689:	75 07                	jne    c0109692 <find_vma+0xb6>
                    vma = NULL;
c010968b:	c7 45 e4 00 00 00 00 	movl   $0x0,-0x1c(%ebp)
                }
            }
        }
        if (vma != NULL) {
c0109692:	83 7d e4 00          	cmpl   $0x0,-0x1c(%ebp)
c0109696:	74 09                	je     c01096a1 <find_vma+0xc5>
            mm->mmap_cache = vma;
c0109698:	8b 45 08             	mov    0x8(%ebp),%eax
c010969b:	8b 55 e4             	mov    -0x1c(%ebp),%edx
c010969e:	89 50 0c             	mov    %edx,0xc(%eax)
        }
    }
    return vma;
c01096a1:	8b 45 e4             	mov    -0x1c(%ebp),%eax
}
c01096a4:	c9                   	leave  
c01096a5:	c3                   	ret    

c01096a6 <vma_compare>:

// vma_compare - compare vma1->vm_start < vma2->vm_start ?
static inline int
vma_compare(rb_node *node1, rb_node *node2) {
c01096a6:	55                   	push   %ebp
c01096a7:	89 e5                	mov    %esp,%ebp
c01096a9:	83 ec 10             	sub    $0x10,%esp
    struct vma_struct *vma1 = rbn2vma(node1, rb_link);
c01096ac:	8b 45 08             	mov    0x8(%ebp),%eax
c01096af:	83 e8 10             	sub    $0x10,%eax
c01096b2:	89 45 f0             	mov    %eax,-0x10(%ebp)
    struct vma_struct *vma2 = rbn2vma(node2, rb_link);
c01096b5:	8b 45 0c             	mov    0xc(%ebp),%eax
c01096b8:	83 e8 10             	sub    $0x10,%eax
c01096bb:	89 45 f4             	mov    %eax,-0xc(%ebp)
    uintptr_t start1 = vma1->vm_start, start2 = vma2->vm_start;
c01096be:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01096c1:	8b 40 04             	mov    0x4(%eax),%eax
c01096c4:	89 45 f8             	mov    %eax,-0x8(%ebp)
c01096c7:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01096ca:	8b 40 04             	mov    0x4(%eax),%eax
c01096cd:	89 45 fc             	mov    %eax,-0x4(%ebp)
    return (start1 < start2) ? -1 : (start1 > start2) ? 1 : 0;
c01096d0:	8b 45 f8             	mov    -0x8(%ebp),%eax
c01096d3:	3b 45 fc             	cmp    -0x4(%ebp),%eax
c01096d6:	72 0e                	jb     c01096e6 <vma_compare+0x40>
c01096d8:	8b 45 f8             	mov    -0x8(%ebp),%eax
c01096db:	3b 45 fc             	cmp    -0x4(%ebp),%eax
c01096de:	0f 97 c0             	seta   %al
c01096e1:	0f b6 c0             	movzbl %al,%eax
c01096e4:	eb 05                	jmp    c01096eb <vma_compare+0x45>
c01096e6:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
}
c01096eb:	c9                   	leave  
c01096ec:	c3                   	ret    

c01096ed <check_vma_overlap>:

// check_vma_overlap - check if vma1 overlaps vma2 ?
static inline void
check_vma_overlap(struct vma_struct *prev, struct vma_struct *next) {
c01096ed:	55                   	push   %ebp
c01096ee:	89 e5                	mov    %esp,%ebp
c01096f0:	83 ec 18             	sub    $0x18,%esp
    assert(prev->vm_start < prev->vm_end);
c01096f3:	8b 45 08             	mov    0x8(%ebp),%eax
c01096f6:	8b 50 04             	mov    0x4(%eax),%edx
c01096f9:	8b 45 08             	mov    0x8(%ebp),%eax
c01096fc:	8b 40 08             	mov    0x8(%eax),%eax
c01096ff:	39 c2                	cmp    %eax,%edx
c0109701:	72 24                	jb     c0109727 <check_vma_overlap+0x3a>
c0109703:	c7 44 24 0c 21 ce 10 	movl   $0xc010ce21,0xc(%esp)
c010970a:	c0 
c010970b:	c7 44 24 08 3f ce 10 	movl   $0xc010ce3f,0x8(%esp)
c0109712:	c0 
c0109713:	c7 44 24 04 87 00 00 	movl   $0x87,0x4(%esp)
c010971a:	00 
c010971b:	c7 04 24 54 ce 10 c0 	movl   $0xc010ce54,(%esp)
c0109722:	e8 89 93 ff ff       	call   c0102ab0 <__panic>
    assert(prev->vm_end <= next->vm_start);
c0109727:	8b 45 08             	mov    0x8(%ebp),%eax
c010972a:	8b 50 08             	mov    0x8(%eax),%edx
c010972d:	8b 45 0c             	mov    0xc(%ebp),%eax
c0109730:	8b 40 04             	mov    0x4(%eax),%eax
c0109733:	39 c2                	cmp    %eax,%edx
c0109735:	76 24                	jbe    c010975b <check_vma_overlap+0x6e>
c0109737:	c7 44 24 0c 64 ce 10 	movl   $0xc010ce64,0xc(%esp)
c010973e:	c0 
c010973f:	c7 44 24 08 3f ce 10 	movl   $0xc010ce3f,0x8(%esp)
c0109746:	c0 
c0109747:	c7 44 24 04 88 00 00 	movl   $0x88,0x4(%esp)
c010974e:	00 
c010974f:	c7 04 24 54 ce 10 c0 	movl   $0xc010ce54,(%esp)
c0109756:	e8 55 93 ff ff       	call   c0102ab0 <__panic>
    assert(next->vm_start < next->vm_end);
c010975b:	8b 45 0c             	mov    0xc(%ebp),%eax
c010975e:	8b 50 04             	mov    0x4(%eax),%edx
c0109761:	8b 45 0c             	mov    0xc(%ebp),%eax
c0109764:	8b 40 08             	mov    0x8(%eax),%eax
c0109767:	39 c2                	cmp    %eax,%edx
c0109769:	72 24                	jb     c010978f <check_vma_overlap+0xa2>
c010976b:	c7 44 24 0c 83 ce 10 	movl   $0xc010ce83,0xc(%esp)
c0109772:	c0 
c0109773:	c7 44 24 08 3f ce 10 	movl   $0xc010ce3f,0x8(%esp)
c010977a:	c0 
c010977b:	c7 44 24 04 89 00 00 	movl   $0x89,0x4(%esp)
c0109782:	00 
c0109783:	c7 04 24 54 ce 10 c0 	movl   $0xc010ce54,(%esp)
c010978a:	e8 21 93 ff ff       	call   c0102ab0 <__panic>
}
c010978f:	c9                   	leave  
c0109790:	c3                   	ret    

c0109791 <insert_vma_rb>:

// insert_vma_rb - insert vma in rb tree according vma->start_addr
static inline void
insert_vma_rb(rb_tree *tree, struct vma_struct *vma, struct vma_struct **vma_prevp) {
c0109791:	55                   	push   %ebp
c0109792:	89 e5                	mov    %esp,%ebp
c0109794:	83 ec 28             	sub    $0x28,%esp
    rb_node *node = &(vma->rb_link), *prev;
c0109797:	8b 45 0c             	mov    0xc(%ebp),%eax
c010979a:	83 c0 10             	add    $0x10,%eax
c010979d:	89 45 f0             	mov    %eax,-0x10(%ebp)
    rb_insert(tree, node);
c01097a0:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01097a3:	89 44 24 04          	mov    %eax,0x4(%esp)
c01097a7:	8b 45 08             	mov    0x8(%ebp),%eax
c01097aa:	89 04 24             	mov    %eax,(%esp)
c01097ad:	e8 c7 6c ff ff       	call   c0100479 <rb_insert>
    if (vma_prevp != NULL) {
c01097b2:	83 7d 10 00          	cmpl   $0x0,0x10(%ebp)
c01097b6:	74 2d                	je     c01097e5 <insert_vma_rb+0x54>
        prev = rb_node_prev(tree, node);
c01097b8:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01097bb:	89 44 24 04          	mov    %eax,0x4(%esp)
c01097bf:	8b 45 08             	mov    0x8(%ebp),%eax
c01097c2:	89 04 24             	mov    %eax,(%esp)
c01097c5:	e8 d9 73 ff ff       	call   c0100ba3 <rb_node_prev>
c01097ca:	89 45 f4             	mov    %eax,-0xc(%ebp)
        *vma_prevp = (prev != NULL) ? rbn2vma(prev, rb_link) : NULL;
c01097cd:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c01097d1:	74 08                	je     c01097db <insert_vma_rb+0x4a>
c01097d3:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01097d6:	83 e8 10             	sub    $0x10,%eax
c01097d9:	eb 05                	jmp    c01097e0 <insert_vma_rb+0x4f>
c01097db:	b8 00 00 00 00       	mov    $0x0,%eax
c01097e0:	8b 55 10             	mov    0x10(%ebp),%edx
c01097e3:	89 02                	mov    %eax,(%edx)
    }
}
c01097e5:	c9                   	leave  
c01097e6:	c3                   	ret    

c01097e7 <insert_vma_struct>:

// insert_vma_struct -insert vma in mm's rb tree link & list link
void
insert_vma_struct(struct mm_struct *mm, struct vma_struct *vma) {
c01097e7:	55                   	push   %ebp
c01097e8:	89 e5                	mov    %esp,%ebp
c01097ea:	83 ec 58             	sub    $0x58,%esp
    assert(vma->vm_start < vma->vm_end);
c01097ed:	8b 45 0c             	mov    0xc(%ebp),%eax
c01097f0:	8b 50 04             	mov    0x4(%eax),%edx
c01097f3:	8b 45 0c             	mov    0xc(%ebp),%eax
c01097f6:	8b 40 08             	mov    0x8(%eax),%eax
c01097f9:	39 c2                	cmp    %eax,%edx
c01097fb:	72 24                	jb     c0109821 <insert_vma_struct+0x3a>
c01097fd:	c7 44 24 0c a1 ce 10 	movl   $0xc010cea1,0xc(%esp)
c0109804:	c0 
c0109805:	c7 44 24 08 3f ce 10 	movl   $0xc010ce3f,0x8(%esp)
c010980c:	c0 
c010980d:	c7 44 24 04 9a 00 00 	movl   $0x9a,0x4(%esp)
c0109814:	00 
c0109815:	c7 04 24 54 ce 10 c0 	movl   $0xc010ce54,(%esp)
c010981c:	e8 8f 92 ff ff       	call   c0102ab0 <__panic>
    list_entry_t *list = &(mm->mmap_list);
c0109821:	8b 45 08             	mov    0x8(%ebp),%eax
c0109824:	89 45 bc             	mov    %eax,-0x44(%ebp)
    list_entry_t *le_prev = list, *le_next;
c0109827:	8b 45 bc             	mov    -0x44(%ebp),%eax
c010982a:	89 45 c0             	mov    %eax,-0x40(%ebp)
    if (mm->mmap_tree != NULL) {
c010982d:	8b 45 08             	mov    0x8(%ebp),%eax
c0109830:	8b 40 08             	mov    0x8(%eax),%eax
c0109833:	85 c0                	test   %eax,%eax
c0109835:	74 2e                	je     c0109865 <insert_vma_struct+0x7e>
        struct vma_struct *mmap_prev;
        insert_vma_rb(mm->mmap_tree, vma, &mmap_prev);
c0109837:	8b 45 08             	mov    0x8(%ebp),%eax
c010983a:	8b 40 08             	mov    0x8(%eax),%eax
c010983d:	8d 55 b8             	lea    -0x48(%ebp),%edx
c0109840:	89 54 24 08          	mov    %edx,0x8(%esp)
c0109844:	8b 55 0c             	mov    0xc(%ebp),%edx
c0109847:	89 54 24 04          	mov    %edx,0x4(%esp)
c010984b:	89 04 24             	mov    %eax,(%esp)
c010984e:	e8 3e ff ff ff       	call   c0109791 <insert_vma_rb>
        if (mmap_prev != NULL) {
c0109853:	8b 45 b8             	mov    -0x48(%ebp),%eax
c0109856:	85 c0                	test   %eax,%eax
c0109858:	74 4c                	je     c01098a6 <insert_vma_struct+0xbf>
            le_prev = &(mmap_prev->list_link);
c010985a:	8b 45 b8             	mov    -0x48(%ebp),%eax
c010985d:	83 c0 20             	add    $0x20,%eax
c0109860:	89 45 c0             	mov    %eax,-0x40(%ebp)
c0109863:	eb 41                	jmp    c01098a6 <insert_vma_struct+0xbf>
        }
    }
    else {
        list_entry_t *le = list;
c0109865:	8b 45 bc             	mov    -0x44(%ebp),%eax
c0109868:	89 45 c8             	mov    %eax,-0x38(%ebp)
        while ((le = list_next(le)) != list) {
c010986b:	eb 1f                	jmp    c010988c <insert_vma_struct+0xa5>
            struct vma_struct *mmap_prev = le2vma(le, list_link);
c010986d:	8b 45 c8             	mov    -0x38(%ebp),%eax
c0109870:	83 e8 20             	sub    $0x20,%eax
c0109873:	89 45 cc             	mov    %eax,-0x34(%ebp)
            if (mmap_prev->vm_start > vma->vm_start) {
c0109876:	8b 45 cc             	mov    -0x34(%ebp),%eax
c0109879:	8b 50 04             	mov    0x4(%eax),%edx
c010987c:	8b 45 0c             	mov    0xc(%ebp),%eax
c010987f:	8b 40 04             	mov    0x4(%eax),%eax
c0109882:	39 c2                	cmp    %eax,%edx
c0109884:	77 1f                	ja     c01098a5 <insert_vma_struct+0xbe>
                break;
            }
            le_prev = le;
c0109886:	8b 45 c8             	mov    -0x38(%ebp),%eax
c0109889:	89 45 c0             	mov    %eax,-0x40(%ebp)
c010988c:	8b 45 c8             	mov    -0x38(%ebp),%eax
c010988f:	89 45 d8             	mov    %eax,-0x28(%ebp)
c0109892:	8b 45 d8             	mov    -0x28(%ebp),%eax
c0109895:	8b 40 04             	mov    0x4(%eax),%eax
            le_prev = &(mmap_prev->list_link);
        }
    }
    else {
        list_entry_t *le = list;
        while ((le = list_next(le)) != list) {
c0109898:	89 45 c8             	mov    %eax,-0x38(%ebp)
c010989b:	8b 45 c8             	mov    -0x38(%ebp),%eax
c010989e:	3b 45 bc             	cmp    -0x44(%ebp),%eax
c01098a1:	75 ca                	jne    c010986d <insert_vma_struct+0x86>
c01098a3:	eb 01                	jmp    c01098a6 <insert_vma_struct+0xbf>
            struct vma_struct *mmap_prev = le2vma(le, list_link);
            if (mmap_prev->vm_start > vma->vm_start) {
                break;
c01098a5:	90                   	nop
            le_prev = &(mmap_prev->list_link);
        }
    }
    else {
        list_entry_t *le = list;
        while ((le = list_next(le)) != list) {
c01098a6:	8b 45 c0             	mov    -0x40(%ebp),%eax
c01098a9:	89 45 dc             	mov    %eax,-0x24(%ebp)
c01098ac:	8b 45 dc             	mov    -0x24(%ebp),%eax
c01098af:	8b 40 04             	mov    0x4(%eax),%eax
            }
            le_prev = le;
        }
    }

    le_next = list_next(le_prev);
c01098b2:	89 45 c4             	mov    %eax,-0x3c(%ebp)

    /* check overlap */
    if (le_prev != list) {
c01098b5:	8b 45 c0             	mov    -0x40(%ebp),%eax
c01098b8:	3b 45 bc             	cmp    -0x44(%ebp),%eax
c01098bb:	74 15                	je     c01098d2 <insert_vma_struct+0xeb>
        check_vma_overlap(le2vma(le_prev, list_link), vma);
c01098bd:	8b 45 c0             	mov    -0x40(%ebp),%eax
c01098c0:	8d 50 e0             	lea    -0x20(%eax),%edx
c01098c3:	8b 45 0c             	mov    0xc(%ebp),%eax
c01098c6:	89 44 24 04          	mov    %eax,0x4(%esp)
c01098ca:	89 14 24             	mov    %edx,(%esp)
c01098cd:	e8 1b fe ff ff       	call   c01096ed <check_vma_overlap>
    }
    if (le_next != list) {
c01098d2:	8b 45 c4             	mov    -0x3c(%ebp),%eax
c01098d5:	3b 45 bc             	cmp    -0x44(%ebp),%eax
c01098d8:	74 15                	je     c01098ef <insert_vma_struct+0x108>
        check_vma_overlap(vma, le2vma(le_next, list_link));
c01098da:	8b 45 c4             	mov    -0x3c(%ebp),%eax
c01098dd:	83 e8 20             	sub    $0x20,%eax
c01098e0:	89 44 24 04          	mov    %eax,0x4(%esp)
c01098e4:	8b 45 0c             	mov    0xc(%ebp),%eax
c01098e7:	89 04 24             	mov    %eax,(%esp)
c01098ea:	e8 fe fd ff ff       	call   c01096ed <check_vma_overlap>
    }

    vma->vm_mm = mm;
c01098ef:	8b 45 0c             	mov    0xc(%ebp),%eax
c01098f2:	8b 55 08             	mov    0x8(%ebp),%edx
c01098f5:	89 10                	mov    %edx,(%eax)
    list_add_after(le_prev, &(vma->list_link));
c01098f7:	8b 45 0c             	mov    0xc(%ebp),%eax
c01098fa:	8d 50 20             	lea    0x20(%eax),%edx
c01098fd:	8b 45 c0             	mov    -0x40(%ebp),%eax
c0109900:	89 45 e4             	mov    %eax,-0x1c(%ebp)
c0109903:	89 55 e0             	mov    %edx,-0x20(%ebp)
 * Insert the new element @elm *after* the element @listelm which
 * is already in the list.
 * */
static inline void
list_add_after(list_entry_t *listelm, list_entry_t *elm) {
    __list_add(elm, listelm, listelm->next);
c0109906:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0109909:	8b 40 04             	mov    0x4(%eax),%eax
c010990c:	8b 55 e0             	mov    -0x20(%ebp),%edx
c010990f:	89 55 f0             	mov    %edx,-0x10(%ebp)
c0109912:	8b 55 e4             	mov    -0x1c(%ebp),%edx
c0109915:	89 55 ec             	mov    %edx,-0x14(%ebp)
c0109918:	89 45 e8             	mov    %eax,-0x18(%ebp)
 * This is only for internal list manipulation where we know
 * the prev/next entries already!
 * */
static inline void
__list_add(list_entry_t *elm, list_entry_t *prev, list_entry_t *next) {
    prev->next = next->prev = elm;
c010991b:	8b 45 e8             	mov    -0x18(%ebp),%eax
c010991e:	8b 55 f0             	mov    -0x10(%ebp),%edx
c0109921:	89 10                	mov    %edx,(%eax)
c0109923:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0109926:	8b 10                	mov    (%eax),%edx
c0109928:	8b 45 ec             	mov    -0x14(%ebp),%eax
c010992b:	89 50 04             	mov    %edx,0x4(%eax)
    elm->next = next;
c010992e:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0109931:	8b 55 e8             	mov    -0x18(%ebp),%edx
c0109934:	89 50 04             	mov    %edx,0x4(%eax)
    elm->prev = prev;
c0109937:	8b 45 f0             	mov    -0x10(%ebp),%eax
c010993a:	8b 55 ec             	mov    -0x14(%ebp),%edx
c010993d:	89 10                	mov    %edx,(%eax)

    mm->map_count ++;
c010993f:	8b 45 08             	mov    0x8(%ebp),%eax
c0109942:	8b 40 14             	mov    0x14(%eax),%eax
c0109945:	8d 50 01             	lea    0x1(%eax),%edx
c0109948:	8b 45 08             	mov    0x8(%ebp),%eax
c010994b:	89 50 14             	mov    %edx,0x14(%eax)
    if (mm->mmap_tree == NULL && mm->map_count >= RB_MIN_MAP_COUNT) {
c010994e:	8b 45 08             	mov    0x8(%ebp),%eax
c0109951:	8b 40 08             	mov    0x8(%eax),%eax
c0109954:	85 c0                	test   %eax,%eax
c0109956:	75 6c                	jne    c01099c4 <insert_vma_struct+0x1dd>
c0109958:	8b 45 08             	mov    0x8(%ebp),%eax
c010995b:	8b 40 14             	mov    0x14(%eax),%eax
c010995e:	83 f8 1f             	cmp    $0x1f,%eax
c0109961:	7e 61                	jle    c01099c4 <insert_vma_struct+0x1dd>

        /* try to build red-black tree now, but may fail. */
        mm->mmap_tree = rb_tree_create(vma_compare);
c0109963:	c7 04 24 a6 96 10 c0 	movl   $0xc01096a6,(%esp)
c010996a:	e8 72 67 ff ff       	call   c01000e1 <rb_tree_create>
c010996f:	8b 55 08             	mov    0x8(%ebp),%edx
c0109972:	89 42 08             	mov    %eax,0x8(%edx)

        if (mm->mmap_tree != NULL) {
c0109975:	8b 45 08             	mov    0x8(%ebp),%eax
c0109978:	8b 40 08             	mov    0x8(%eax),%eax
c010997b:	85 c0                	test   %eax,%eax
c010997d:	74 45                	je     c01099c4 <insert_vma_struct+0x1dd>
            list_entry_t *list = &(mm->mmap_list), *le = list;
c010997f:	8b 45 08             	mov    0x8(%ebp),%eax
c0109982:	89 45 d0             	mov    %eax,-0x30(%ebp)
c0109985:	8b 45 d0             	mov    -0x30(%ebp),%eax
c0109988:	89 45 d4             	mov    %eax,-0x2c(%ebp)
            while ((le = list_next(le)) != list) {
c010998b:	eb 20                	jmp    c01099ad <insert_vma_struct+0x1c6>
                insert_vma_rb(mm->mmap_tree, le2vma(le, list_link), NULL);
c010998d:	8b 45 d4             	mov    -0x2c(%ebp),%eax
c0109990:	8d 50 e0             	lea    -0x20(%eax),%edx
c0109993:	8b 45 08             	mov    0x8(%ebp),%eax
c0109996:	8b 40 08             	mov    0x8(%eax),%eax
c0109999:	c7 44 24 08 00 00 00 	movl   $0x0,0x8(%esp)
c01099a0:	00 
c01099a1:	89 54 24 04          	mov    %edx,0x4(%esp)
c01099a5:	89 04 24             	mov    %eax,(%esp)
c01099a8:	e8 e4 fd ff ff       	call   c0109791 <insert_vma_rb>
c01099ad:	8b 45 d4             	mov    -0x2c(%ebp),%eax
c01099b0:	89 45 f4             	mov    %eax,-0xc(%ebp)
 * list_next - get the next entry
 * @listelm:    the list head
 **/
static list_entry_t *
list_next(list_entry_t *listelm) {
    return listelm->next;
c01099b3:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01099b6:	8b 40 04             	mov    0x4(%eax),%eax
        /* try to build red-black tree now, but may fail. */
        mm->mmap_tree = rb_tree_create(vma_compare);

        if (mm->mmap_tree != NULL) {
            list_entry_t *list = &(mm->mmap_list), *le = list;
            while ((le = list_next(le)) != list) {
c01099b9:	89 45 d4             	mov    %eax,-0x2c(%ebp)
c01099bc:	8b 45 d4             	mov    -0x2c(%ebp),%eax
c01099bf:	3b 45 d0             	cmp    -0x30(%ebp),%eax
c01099c2:	75 c9                	jne    c010998d <insert_vma_struct+0x1a6>
                insert_vma_rb(mm->mmap_tree, le2vma(le, list_link), NULL);
            }
        }
    }
}
c01099c4:	c9                   	leave  
c01099c5:	c3                   	ret    

c01099c6 <mm_destroy>:

// mm_destroy - free mm and mm internal fields
void
mm_destroy(struct mm_struct *mm) {
c01099c6:	55                   	push   %ebp
c01099c7:	89 e5                	mov    %esp,%ebp
c01099c9:	83 ec 38             	sub    $0x38,%esp
    if (mm->mmap_tree != NULL) {
c01099cc:	8b 45 08             	mov    0x8(%ebp),%eax
c01099cf:	8b 40 08             	mov    0x8(%eax),%eax
c01099d2:	85 c0                	test   %eax,%eax
c01099d4:	74 0e                	je     c01099e4 <mm_destroy+0x1e>
        rb_tree_destroy(mm->mmap_tree);
c01099d6:	8b 45 08             	mov    0x8(%ebp),%eax
c01099d9:	8b 40 08             	mov    0x8(%eax),%eax
c01099dc:	89 04 24             	mov    %eax,(%esp)
c01099df:	e8 90 71 ff ff       	call   c0100b74 <rb_tree_destroy>
    }
    list_entry_t *list = &(mm->mmap_list), *le;
c01099e4:	8b 45 08             	mov    0x8(%ebp),%eax
c01099e7:	89 45 e0             	mov    %eax,-0x20(%ebp)
    while ((le = list_next(list)) != list) {
c01099ea:	eb 36                	jmp    c0109a22 <mm_destroy+0x5c>
c01099ec:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c01099ef:	89 45 e8             	mov    %eax,-0x18(%ebp)
 * Note: list_empty() on @listelm does not return true after this, the entry is
 * in an undefined state.
 * */
static inline void
list_del(list_entry_t *listelm) {
    __list_del(listelm->prev, listelm->next);
c01099f2:	8b 45 e8             	mov    -0x18(%ebp),%eax
c01099f5:	8b 40 04             	mov    0x4(%eax),%eax
c01099f8:	8b 55 e8             	mov    -0x18(%ebp),%edx
c01099fb:	8b 12                	mov    (%edx),%edx
c01099fd:	89 55 f0             	mov    %edx,-0x10(%ebp)
c0109a00:	89 45 ec             	mov    %eax,-0x14(%ebp)
 * This is only for internal list manipulation where we know
 * the prev/next entries already!
 * */
static inline void
__list_del(list_entry_t *prev, list_entry_t *next) {
    prev->next = next;
c0109a03:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0109a06:	8b 55 ec             	mov    -0x14(%ebp),%edx
c0109a09:	89 50 04             	mov    %edx,0x4(%eax)
    next->prev = prev;
c0109a0c:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0109a0f:	8b 55 f0             	mov    -0x10(%ebp),%edx
c0109a12:	89 10                	mov    %edx,(%eax)
        list_del(le);
        kfree(le2vma(le, list_link));
c0109a14:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0109a17:	83 e8 20             	sub    $0x20,%eax
c0109a1a:	89 04 24             	mov    %eax,(%esp)
c0109a1d:	e8 42 ea ff ff       	call   c0108464 <kfree>
c0109a22:	8b 45 e0             	mov    -0x20(%ebp),%eax
c0109a25:	89 45 f4             	mov    %eax,-0xc(%ebp)
 * list_next - get the next entry
 * @listelm:    the list head
 **/
static list_entry_t *
list_next(list_entry_t *listelm) {
    return listelm->next;
c0109a28:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0109a2b:	8b 40 04             	mov    0x4(%eax),%eax
mm_destroy(struct mm_struct *mm) {
    if (mm->mmap_tree != NULL) {
        rb_tree_destroy(mm->mmap_tree);
    }
    list_entry_t *list = &(mm->mmap_list), *le;
    while ((le = list_next(list)) != list) {
c0109a2e:	89 45 e4             	mov    %eax,-0x1c(%ebp)
c0109a31:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0109a34:	3b 45 e0             	cmp    -0x20(%ebp),%eax
c0109a37:	75 b3                	jne    c01099ec <mm_destroy+0x26>
        list_del(le);
        kfree(le2vma(le, list_link));
    }
    kfree(mm);
c0109a39:	8b 45 08             	mov    0x8(%ebp),%eax
c0109a3c:	89 04 24             	mov    %eax,(%esp)
c0109a3f:	e8 20 ea ff ff       	call   c0108464 <kfree>
}
c0109a44:	c9                   	leave  
c0109a45:	c3                   	ret    

c0109a46 <vmm_init>:

// vmm_init - initialize virtual memory management
//          - now just call check_vmm to check correctness of vmm
void
vmm_init(void) {
c0109a46:	55                   	push   %ebp
c0109a47:	89 e5                	mov    %esp,%ebp
c0109a49:	83 ec 08             	sub    $0x8,%esp
    check_vmm();
c0109a4c:	e8 02 00 00 00       	call   c0109a53 <check_vmm>
}
c0109a51:	c9                   	leave  
c0109a52:	c3                   	ret    

c0109a53 <check_vmm>:

// check_vmm - check correctness of vmm
static void
check_vmm(void) {
c0109a53:	55                   	push   %ebp
c0109a54:	89 e5                	mov    %esp,%ebp
c0109a56:	83 ec 28             	sub    $0x28,%esp
    size_t nr_free_pages_store = nr_free_pages();
c0109a59:	e8 d3 c5 ff ff       	call   c0106031 <nr_free_pages>
c0109a5e:	89 45 f0             	mov    %eax,-0x10(%ebp)
    size_t slab_allocated_store = slab_allocated();
c0109a61:	e8 bd de ff ff       	call   c0107923 <slab_allocated>
c0109a66:	89 45 f4             	mov    %eax,-0xc(%ebp)

    check_vma_struct();
c0109a69:	e8 6f 00 00 00       	call   c0109add <check_vma_struct>
    check_pgfault();
c0109a6e:	e8 e2 03 00 00       	call   c0109e55 <check_pgfault>

    assert(nr_free_pages_store == nr_free_pages());
c0109a73:	e8 b9 c5 ff ff       	call   c0106031 <nr_free_pages>
c0109a78:	3b 45 f0             	cmp    -0x10(%ebp),%eax
c0109a7b:	74 24                	je     c0109aa1 <check_vmm+0x4e>
c0109a7d:	c7 44 24 0c c0 ce 10 	movl   $0xc010cec0,0xc(%esp)
c0109a84:	c0 
c0109a85:	c7 44 24 08 3f ce 10 	movl   $0xc010ce3f,0x8(%esp)
c0109a8c:	c0 
c0109a8d:	c7 44 24 04 e9 00 00 	movl   $0xe9,0x4(%esp)
c0109a94:	00 
c0109a95:	c7 04 24 54 ce 10 c0 	movl   $0xc010ce54,(%esp)
c0109a9c:	e8 0f 90 ff ff       	call   c0102ab0 <__panic>
    assert(slab_allocated_store == slab_allocated());
c0109aa1:	e8 7d de ff ff       	call   c0107923 <slab_allocated>
c0109aa6:	3b 45 f4             	cmp    -0xc(%ebp),%eax
c0109aa9:	74 24                	je     c0109acf <check_vmm+0x7c>
c0109aab:	c7 44 24 0c e8 ce 10 	movl   $0xc010cee8,0xc(%esp)
c0109ab2:	c0 
c0109ab3:	c7 44 24 08 3f ce 10 	movl   $0xc010ce3f,0x8(%esp)
c0109aba:	c0 
c0109abb:	c7 44 24 04 ea 00 00 	movl   $0xea,0x4(%esp)
c0109ac2:	00 
c0109ac3:	c7 04 24 54 ce 10 c0 	movl   $0xc010ce54,(%esp)
c0109aca:	e8 e1 8f ff ff       	call   c0102ab0 <__panic>

    cprintf("check_vmm() succeeded.\n");
c0109acf:	c7 04 24 11 cf 10 c0 	movl   $0xc010cf11,(%esp)
c0109ad6:	e8 f1 7a ff ff       	call   c01015cc <cprintf>
}
c0109adb:	c9                   	leave  
c0109adc:	c3                   	ret    

c0109add <check_vma_struct>:

static void
check_vma_struct(void) {
c0109add:	55                   	push   %ebp
c0109ade:	89 e5                	mov    %esp,%ebp
c0109ae0:	83 ec 58             	sub    $0x58,%esp
    size_t nr_free_pages_store = nr_free_pages();
c0109ae3:	e8 49 c5 ff ff       	call   c0106031 <nr_free_pages>
c0109ae8:	89 45 c0             	mov    %eax,-0x40(%ebp)
    size_t slab_allocated_store = slab_allocated();
c0109aeb:	e8 33 de ff ff       	call   c0107923 <slab_allocated>
c0109af0:	89 45 c4             	mov    %eax,-0x3c(%ebp)

    struct mm_struct *mm = mm_create();
c0109af3:	e8 cb f9 ff ff       	call   c01094c3 <mm_create>
c0109af8:	89 45 c8             	mov    %eax,-0x38(%ebp)
    assert(mm != NULL);
c0109afb:	83 7d c8 00          	cmpl   $0x0,-0x38(%ebp)
c0109aff:	75 24                	jne    c0109b25 <check_vma_struct+0x48>
c0109b01:	c7 44 24 0c 29 cf 10 	movl   $0xc010cf29,0xc(%esp)
c0109b08:	c0 
c0109b09:	c7 44 24 08 3f ce 10 	movl   $0xc010ce3f,0x8(%esp)
c0109b10:	c0 
c0109b11:	c7 44 24 04 f5 00 00 	movl   $0xf5,0x4(%esp)
c0109b18:	00 
c0109b19:	c7 04 24 54 ce 10 c0 	movl   $0xc010ce54,(%esp)
c0109b20:	e8 8b 8f ff ff       	call   c0102ab0 <__panic>

    int step1 = RB_MIN_MAP_COUNT * 2, step2 = step1 * 10;
c0109b25:	c7 45 cc 40 00 00 00 	movl   $0x40,-0x34(%ebp)
c0109b2c:	8b 55 cc             	mov    -0x34(%ebp),%edx
c0109b2f:	89 d0                	mov    %edx,%eax
c0109b31:	c1 e0 02             	shl    $0x2,%eax
c0109b34:	01 d0                	add    %edx,%eax
c0109b36:	01 c0                	add    %eax,%eax
c0109b38:	89 45 d0             	mov    %eax,-0x30(%ebp)

    int i;
    for (i = step1; i >= 0; i --) {
c0109b3b:	8b 45 cc             	mov    -0x34(%ebp),%eax
c0109b3e:	89 45 d4             	mov    %eax,-0x2c(%ebp)
c0109b41:	eb 70                	jmp    c0109bb3 <check_vma_struct+0xd6>
        struct vma_struct *vma = vma_create(i * 5, i * 5 + 2, 0);
c0109b43:	8b 55 d4             	mov    -0x2c(%ebp),%edx
c0109b46:	89 d0                	mov    %edx,%eax
c0109b48:	c1 e0 02             	shl    $0x2,%eax
c0109b4b:	01 d0                	add    %edx,%eax
c0109b4d:	83 c0 02             	add    $0x2,%eax
c0109b50:	89 c1                	mov    %eax,%ecx
c0109b52:	8b 55 d4             	mov    -0x2c(%ebp),%edx
c0109b55:	89 d0                	mov    %edx,%eax
c0109b57:	c1 e0 02             	shl    $0x2,%eax
c0109b5a:	01 d0                	add    %edx,%eax
c0109b5c:	c7 44 24 08 00 00 00 	movl   $0x0,0x8(%esp)
c0109b63:	00 
c0109b64:	89 4c 24 04          	mov    %ecx,0x4(%esp)
c0109b68:	89 04 24             	mov    %eax,(%esp)
c0109b6b:	e8 b5 f9 ff ff       	call   c0109525 <vma_create>
c0109b70:	89 45 dc             	mov    %eax,-0x24(%ebp)
        assert(vma != NULL);
c0109b73:	83 7d dc 00          	cmpl   $0x0,-0x24(%ebp)
c0109b77:	75 24                	jne    c0109b9d <check_vma_struct+0xc0>
c0109b79:	c7 44 24 0c 34 cf 10 	movl   $0xc010cf34,0xc(%esp)
c0109b80:	c0 
c0109b81:	c7 44 24 08 3f ce 10 	movl   $0xc010ce3f,0x8(%esp)
c0109b88:	c0 
c0109b89:	c7 44 24 04 fc 00 00 	movl   $0xfc,0x4(%esp)
c0109b90:	00 
c0109b91:	c7 04 24 54 ce 10 c0 	movl   $0xc010ce54,(%esp)
c0109b98:	e8 13 8f ff ff       	call   c0102ab0 <__panic>
        insert_vma_struct(mm, vma);
c0109b9d:	8b 45 dc             	mov    -0x24(%ebp),%eax
c0109ba0:	89 44 24 04          	mov    %eax,0x4(%esp)
c0109ba4:	8b 45 c8             	mov    -0x38(%ebp),%eax
c0109ba7:	89 04 24             	mov    %eax,(%esp)
c0109baa:	e8 38 fc ff ff       	call   c01097e7 <insert_vma_struct>
    assert(mm != NULL);

    int step1 = RB_MIN_MAP_COUNT * 2, step2 = step1 * 10;

    int i;
    for (i = step1; i >= 0; i --) {
c0109baf:	83 6d d4 01          	subl   $0x1,-0x2c(%ebp)
c0109bb3:	83 7d d4 00          	cmpl   $0x0,-0x2c(%ebp)
c0109bb7:	79 8a                	jns    c0109b43 <check_vma_struct+0x66>
        struct vma_struct *vma = vma_create(i * 5, i * 5 + 2, 0);
        assert(vma != NULL);
        insert_vma_struct(mm, vma);
    }

    for (i = step1 + 1; i <= step2; i ++) {
c0109bb9:	8b 45 cc             	mov    -0x34(%ebp),%eax
c0109bbc:	83 c0 01             	add    $0x1,%eax
c0109bbf:	89 45 d4             	mov    %eax,-0x2c(%ebp)
c0109bc2:	eb 70                	jmp    c0109c34 <check_vma_struct+0x157>
        struct vma_struct *vma = vma_create(i * 5, i * 5 + 2, 0);
c0109bc4:	8b 55 d4             	mov    -0x2c(%ebp),%edx
c0109bc7:	89 d0                	mov    %edx,%eax
c0109bc9:	c1 e0 02             	shl    $0x2,%eax
c0109bcc:	01 d0                	add    %edx,%eax
c0109bce:	83 c0 02             	add    $0x2,%eax
c0109bd1:	89 c1                	mov    %eax,%ecx
c0109bd3:	8b 55 d4             	mov    -0x2c(%ebp),%edx
c0109bd6:	89 d0                	mov    %edx,%eax
c0109bd8:	c1 e0 02             	shl    $0x2,%eax
c0109bdb:	01 d0                	add    %edx,%eax
c0109bdd:	c7 44 24 08 00 00 00 	movl   $0x0,0x8(%esp)
c0109be4:	00 
c0109be5:	89 4c 24 04          	mov    %ecx,0x4(%esp)
c0109be9:	89 04 24             	mov    %eax,(%esp)
c0109bec:	e8 34 f9 ff ff       	call   c0109525 <vma_create>
c0109bf1:	89 45 e0             	mov    %eax,-0x20(%ebp)
        assert(vma != NULL);
c0109bf4:	83 7d e0 00          	cmpl   $0x0,-0x20(%ebp)
c0109bf8:	75 24                	jne    c0109c1e <check_vma_struct+0x141>
c0109bfa:	c7 44 24 0c 34 cf 10 	movl   $0xc010cf34,0xc(%esp)
c0109c01:	c0 
c0109c02:	c7 44 24 08 3f ce 10 	movl   $0xc010ce3f,0x8(%esp)
c0109c09:	c0 
c0109c0a:	c7 44 24 04 02 01 00 	movl   $0x102,0x4(%esp)
c0109c11:	00 
c0109c12:	c7 04 24 54 ce 10 c0 	movl   $0xc010ce54,(%esp)
c0109c19:	e8 92 8e ff ff       	call   c0102ab0 <__panic>
        insert_vma_struct(mm, vma);
c0109c1e:	8b 45 e0             	mov    -0x20(%ebp),%eax
c0109c21:	89 44 24 04          	mov    %eax,0x4(%esp)
c0109c25:	8b 45 c8             	mov    -0x38(%ebp),%eax
c0109c28:	89 04 24             	mov    %eax,(%esp)
c0109c2b:	e8 b7 fb ff ff       	call   c01097e7 <insert_vma_struct>
        struct vma_struct *vma = vma_create(i * 5, i * 5 + 2, 0);
        assert(vma != NULL);
        insert_vma_struct(mm, vma);
    }

    for (i = step1 + 1; i <= step2; i ++) {
c0109c30:	83 45 d4 01          	addl   $0x1,-0x2c(%ebp)
c0109c34:	8b 45 d4             	mov    -0x2c(%ebp),%eax
c0109c37:	3b 45 d0             	cmp    -0x30(%ebp),%eax
c0109c3a:	7e 88                	jle    c0109bc4 <check_vma_struct+0xe7>
        struct vma_struct *vma = vma_create(i * 5, i * 5 + 2, 0);
        assert(vma != NULL);
        insert_vma_struct(mm, vma);
    }

    list_entry_t *le = list_next(&(mm->mmap_list));
c0109c3c:	8b 45 c8             	mov    -0x38(%ebp),%eax
c0109c3f:	89 45 f0             	mov    %eax,-0x10(%ebp)
c0109c42:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0109c45:	8b 40 04             	mov    0x4(%eax),%eax
c0109c48:	89 45 d8             	mov    %eax,-0x28(%ebp)

    for (i = 0; i <= step2; i ++) {
c0109c4b:	c7 45 d4 00 00 00 00 	movl   $0x0,-0x2c(%ebp)
c0109c52:	e9 97 00 00 00       	jmp    c0109cee <check_vma_struct+0x211>
        assert(le != &(mm->mmap_list));
c0109c57:	8b 45 c8             	mov    -0x38(%ebp),%eax
c0109c5a:	3b 45 d8             	cmp    -0x28(%ebp),%eax
c0109c5d:	75 24                	jne    c0109c83 <check_vma_struct+0x1a6>
c0109c5f:	c7 44 24 0c 40 cf 10 	movl   $0xc010cf40,0xc(%esp)
c0109c66:	c0 
c0109c67:	c7 44 24 08 3f ce 10 	movl   $0xc010ce3f,0x8(%esp)
c0109c6e:	c0 
c0109c6f:	c7 44 24 04 09 01 00 	movl   $0x109,0x4(%esp)
c0109c76:	00 
c0109c77:	c7 04 24 54 ce 10 c0 	movl   $0xc010ce54,(%esp)
c0109c7e:	e8 2d 8e ff ff       	call   c0102ab0 <__panic>
        struct vma_struct *mmap = le2vma(le, list_link);
c0109c83:	8b 45 d8             	mov    -0x28(%ebp),%eax
c0109c86:	83 e8 20             	sub    $0x20,%eax
c0109c89:	89 45 e4             	mov    %eax,-0x1c(%ebp)
        assert(mmap->vm_start == i * 5 && mmap->vm_end == i * 5 + 2);
c0109c8c:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0109c8f:	8b 48 04             	mov    0x4(%eax),%ecx
c0109c92:	8b 55 d4             	mov    -0x2c(%ebp),%edx
c0109c95:	89 d0                	mov    %edx,%eax
c0109c97:	c1 e0 02             	shl    $0x2,%eax
c0109c9a:	01 d0                	add    %edx,%eax
c0109c9c:	39 c1                	cmp    %eax,%ecx
c0109c9e:	75 17                	jne    c0109cb7 <check_vma_struct+0x1da>
c0109ca0:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0109ca3:	8b 48 08             	mov    0x8(%eax),%ecx
c0109ca6:	8b 55 d4             	mov    -0x2c(%ebp),%edx
c0109ca9:	89 d0                	mov    %edx,%eax
c0109cab:	c1 e0 02             	shl    $0x2,%eax
c0109cae:	01 d0                	add    %edx,%eax
c0109cb0:	83 c0 02             	add    $0x2,%eax
c0109cb3:	39 c1                	cmp    %eax,%ecx
c0109cb5:	74 24                	je     c0109cdb <check_vma_struct+0x1fe>
c0109cb7:	c7 44 24 0c 58 cf 10 	movl   $0xc010cf58,0xc(%esp)
c0109cbe:	c0 
c0109cbf:	c7 44 24 08 3f ce 10 	movl   $0xc010ce3f,0x8(%esp)
c0109cc6:	c0 
c0109cc7:	c7 44 24 04 0b 01 00 	movl   $0x10b,0x4(%esp)
c0109cce:	00 
c0109ccf:	c7 04 24 54 ce 10 c0 	movl   $0xc010ce54,(%esp)
c0109cd6:	e8 d5 8d ff ff       	call   c0102ab0 <__panic>
c0109cdb:	8b 45 d8             	mov    -0x28(%ebp),%eax
c0109cde:	89 45 f4             	mov    %eax,-0xc(%ebp)
c0109ce1:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0109ce4:	8b 40 04             	mov    0x4(%eax),%eax
        le = list_next(le);
c0109ce7:	89 45 d8             	mov    %eax,-0x28(%ebp)
        insert_vma_struct(mm, vma);
    }

    list_entry_t *le = list_next(&(mm->mmap_list));

    for (i = 0; i <= step2; i ++) {
c0109cea:	83 45 d4 01          	addl   $0x1,-0x2c(%ebp)
c0109cee:	8b 45 d4             	mov    -0x2c(%ebp),%eax
c0109cf1:	3b 45 d0             	cmp    -0x30(%ebp),%eax
c0109cf4:	0f 8e 5d ff ff ff    	jle    c0109c57 <check_vma_struct+0x17a>
        struct vma_struct *mmap = le2vma(le, list_link);
        assert(mmap->vm_start == i * 5 && mmap->vm_end == i * 5 + 2);
        le = list_next(le);
    }

    for (i = 0; i < 5 * step2 + 2; i ++) {
c0109cfa:	c7 45 d4 00 00 00 00 	movl   $0x0,-0x2c(%ebp)
c0109d01:	e9 c4 00 00 00       	jmp    c0109dca <check_vma_struct+0x2ed>
        struct vma_struct *vma = find_vma(mm, i);
c0109d06:	8b 45 d4             	mov    -0x2c(%ebp),%eax
c0109d09:	89 44 24 04          	mov    %eax,0x4(%esp)
c0109d0d:	8b 45 c8             	mov    -0x38(%ebp),%eax
c0109d10:	89 04 24             	mov    %eax,(%esp)
c0109d13:	e8 c4 f8 ff ff       	call   c01095dc <find_vma>
c0109d18:	89 45 e8             	mov    %eax,-0x18(%ebp)
        assert(vma != NULL);
c0109d1b:	83 7d e8 00          	cmpl   $0x0,-0x18(%ebp)
c0109d1f:	75 24                	jne    c0109d45 <check_vma_struct+0x268>
c0109d21:	c7 44 24 0c 34 cf 10 	movl   $0xc010cf34,0xc(%esp)
c0109d28:	c0 
c0109d29:	c7 44 24 08 3f ce 10 	movl   $0xc010ce3f,0x8(%esp)
c0109d30:	c0 
c0109d31:	c7 44 24 04 11 01 00 	movl   $0x111,0x4(%esp)
c0109d38:	00 
c0109d39:	c7 04 24 54 ce 10 c0 	movl   $0xc010ce54,(%esp)
c0109d40:	e8 6b 8d ff ff       	call   c0102ab0 <__panic>
        int j = i / 5;
c0109d45:	8b 4d d4             	mov    -0x2c(%ebp),%ecx
c0109d48:	ba 67 66 66 66       	mov    $0x66666667,%edx
c0109d4d:	89 c8                	mov    %ecx,%eax
c0109d4f:	f7 ea                	imul   %edx
c0109d51:	d1 fa                	sar    %edx
c0109d53:	89 c8                	mov    %ecx,%eax
c0109d55:	c1 f8 1f             	sar    $0x1f,%eax
c0109d58:	89 d1                	mov    %edx,%ecx
c0109d5a:	29 c1                	sub    %eax,%ecx
c0109d5c:	89 c8                	mov    %ecx,%eax
c0109d5e:	89 45 ec             	mov    %eax,-0x14(%ebp)
        if (i >= 5 * j + 2) {
c0109d61:	8b 55 ec             	mov    -0x14(%ebp),%edx
c0109d64:	89 d0                	mov    %edx,%eax
c0109d66:	c1 e0 02             	shl    $0x2,%eax
c0109d69:	01 d0                	add    %edx,%eax
c0109d6b:	83 c0 02             	add    $0x2,%eax
c0109d6e:	3b 45 d4             	cmp    -0x2c(%ebp),%eax
c0109d71:	7f 04                	jg     c0109d77 <check_vma_struct+0x29a>
            j ++;
c0109d73:	83 45 ec 01          	addl   $0x1,-0x14(%ebp)
        }
        assert(vma->vm_start == j * 5 && vma->vm_end == j * 5 + 2);
c0109d77:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0109d7a:	8b 48 04             	mov    0x4(%eax),%ecx
c0109d7d:	8b 55 ec             	mov    -0x14(%ebp),%edx
c0109d80:	89 d0                	mov    %edx,%eax
c0109d82:	c1 e0 02             	shl    $0x2,%eax
c0109d85:	01 d0                	add    %edx,%eax
c0109d87:	39 c1                	cmp    %eax,%ecx
c0109d89:	75 17                	jne    c0109da2 <check_vma_struct+0x2c5>
c0109d8b:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0109d8e:	8b 48 08             	mov    0x8(%eax),%ecx
c0109d91:	8b 55 ec             	mov    -0x14(%ebp),%edx
c0109d94:	89 d0                	mov    %edx,%eax
c0109d96:	c1 e0 02             	shl    $0x2,%eax
c0109d99:	01 d0                	add    %edx,%eax
c0109d9b:	83 c0 02             	add    $0x2,%eax
c0109d9e:	39 c1                	cmp    %eax,%ecx
c0109da0:	74 24                	je     c0109dc6 <check_vma_struct+0x2e9>
c0109da2:	c7 44 24 0c 90 cf 10 	movl   $0xc010cf90,0xc(%esp)
c0109da9:	c0 
c0109daa:	c7 44 24 08 3f ce 10 	movl   $0xc010ce3f,0x8(%esp)
c0109db1:	c0 
c0109db2:	c7 44 24 04 16 01 00 	movl   $0x116,0x4(%esp)
c0109db9:	00 
c0109dba:	c7 04 24 54 ce 10 c0 	movl   $0xc010ce54,(%esp)
c0109dc1:	e8 ea 8c ff ff       	call   c0102ab0 <__panic>
        struct vma_struct *mmap = le2vma(le, list_link);
        assert(mmap->vm_start == i * 5 && mmap->vm_end == i * 5 + 2);
        le = list_next(le);
    }

    for (i = 0; i < 5 * step2 + 2; i ++) {
c0109dc6:	83 45 d4 01          	addl   $0x1,-0x2c(%ebp)
c0109dca:	8b 55 d0             	mov    -0x30(%ebp),%edx
c0109dcd:	89 d0                	mov    %edx,%eax
c0109dcf:	c1 e0 02             	shl    $0x2,%eax
c0109dd2:	01 d0                	add    %edx,%eax
c0109dd4:	83 c0 02             	add    $0x2,%eax
c0109dd7:	3b 45 d4             	cmp    -0x2c(%ebp),%eax
c0109dda:	0f 8f 26 ff ff ff    	jg     c0109d06 <check_vma_struct+0x229>
            j ++;
        }
        assert(vma->vm_start == j * 5 && vma->vm_end == j * 5 + 2);
    }

    mm_destroy(mm);
c0109de0:	8b 45 c8             	mov    -0x38(%ebp),%eax
c0109de3:	89 04 24             	mov    %eax,(%esp)
c0109de6:	e8 db fb ff ff       	call   c01099c6 <mm_destroy>

    assert(nr_free_pages_store == nr_free_pages());
c0109deb:	e8 41 c2 ff ff       	call   c0106031 <nr_free_pages>
c0109df0:	3b 45 c0             	cmp    -0x40(%ebp),%eax
c0109df3:	74 24                	je     c0109e19 <check_vma_struct+0x33c>
c0109df5:	c7 44 24 0c c0 ce 10 	movl   $0xc010cec0,0xc(%esp)
c0109dfc:	c0 
c0109dfd:	c7 44 24 08 3f ce 10 	movl   $0xc010ce3f,0x8(%esp)
c0109e04:	c0 
c0109e05:	c7 44 24 04 1b 01 00 	movl   $0x11b,0x4(%esp)
c0109e0c:	00 
c0109e0d:	c7 04 24 54 ce 10 c0 	movl   $0xc010ce54,(%esp)
c0109e14:	e8 97 8c ff ff       	call   c0102ab0 <__panic>
    assert(slab_allocated_store == slab_allocated());
c0109e19:	e8 05 db ff ff       	call   c0107923 <slab_allocated>
c0109e1e:	3b 45 c4             	cmp    -0x3c(%ebp),%eax
c0109e21:	74 24                	je     c0109e47 <check_vma_struct+0x36a>
c0109e23:	c7 44 24 0c e8 ce 10 	movl   $0xc010cee8,0xc(%esp)
c0109e2a:	c0 
c0109e2b:	c7 44 24 08 3f ce 10 	movl   $0xc010ce3f,0x8(%esp)
c0109e32:	c0 
c0109e33:	c7 44 24 04 1c 01 00 	movl   $0x11c,0x4(%esp)
c0109e3a:	00 
c0109e3b:	c7 04 24 54 ce 10 c0 	movl   $0xc010ce54,(%esp)
c0109e42:	e8 69 8c ff ff       	call   c0102ab0 <__panic>

    cprintf("check_vma_struct() succeeded!\n");
c0109e47:	c7 04 24 c4 cf 10 c0 	movl   $0xc010cfc4,(%esp)
c0109e4e:	e8 79 77 ff ff       	call   c01015cc <cprintf>
}
c0109e53:	c9                   	leave  
c0109e54:	c3                   	ret    

c0109e55 <check_pgfault>:

struct mm_struct *check_mm_struct;

// check_pgfault - check correctness of pgfault handler
static void
check_pgfault(void) {
c0109e55:	55                   	push   %ebp
c0109e56:	89 e5                	mov    %esp,%ebp
c0109e58:	83 ec 48             	sub    $0x48,%esp
    size_t nr_free_pages_store = nr_free_pages();
c0109e5b:	e8 d1 c1 ff ff       	call   c0106031 <nr_free_pages>
c0109e60:	89 45 d4             	mov    %eax,-0x2c(%ebp)
    size_t slab_allocated_store = slab_allocated();
c0109e63:	e8 bb da ff ff       	call   c0107923 <slab_allocated>
c0109e68:	89 45 d8             	mov    %eax,-0x28(%ebp)

    check_mm_struct = mm_create();
c0109e6b:	e8 53 f6 ff ff       	call   c01094c3 <mm_create>
c0109e70:	a3 b8 8c 12 c0       	mov    %eax,0xc0128cb8
    assert(check_mm_struct != NULL);
c0109e75:	a1 b8 8c 12 c0       	mov    0xc0128cb8,%eax
c0109e7a:	85 c0                	test   %eax,%eax
c0109e7c:	75 24                	jne    c0109ea2 <check_pgfault+0x4d>
c0109e7e:	c7 44 24 0c e3 cf 10 	movl   $0xc010cfe3,0xc(%esp)
c0109e85:	c0 
c0109e86:	c7 44 24 08 3f ce 10 	movl   $0xc010ce3f,0x8(%esp)
c0109e8d:	c0 
c0109e8e:	c7 44 24 04 2a 01 00 	movl   $0x12a,0x4(%esp)
c0109e95:	00 
c0109e96:	c7 04 24 54 ce 10 c0 	movl   $0xc010ce54,(%esp)
c0109e9d:	e8 0e 8c ff ff       	call   c0102ab0 <__panic>

    struct mm_struct *mm = check_mm_struct;
c0109ea2:	a1 b8 8c 12 c0       	mov    0xc0128cb8,%eax
c0109ea7:	89 45 dc             	mov    %eax,-0x24(%ebp)
    pde_t *pgdir = mm->pgdir = boot_pgdir;
c0109eaa:	8b 15 04 8a 12 c0    	mov    0xc0128a04,%edx
c0109eb0:	8b 45 dc             	mov    -0x24(%ebp),%eax
c0109eb3:	89 50 10             	mov    %edx,0x10(%eax)
c0109eb6:	8b 45 dc             	mov    -0x24(%ebp),%eax
c0109eb9:	8b 40 10             	mov    0x10(%eax),%eax
c0109ebc:	89 45 e0             	mov    %eax,-0x20(%ebp)
    assert(pgdir[0] == 0);
c0109ebf:	8b 45 e0             	mov    -0x20(%ebp),%eax
c0109ec2:	8b 00                	mov    (%eax),%eax
c0109ec4:	85 c0                	test   %eax,%eax
c0109ec6:	74 24                	je     c0109eec <check_pgfault+0x97>
c0109ec8:	c7 44 24 0c fb cf 10 	movl   $0xc010cffb,0xc(%esp)
c0109ecf:	c0 
c0109ed0:	c7 44 24 08 3f ce 10 	movl   $0xc010ce3f,0x8(%esp)
c0109ed7:	c0 
c0109ed8:	c7 44 24 04 2e 01 00 	movl   $0x12e,0x4(%esp)
c0109edf:	00 
c0109ee0:	c7 04 24 54 ce 10 c0 	movl   $0xc010ce54,(%esp)
c0109ee7:	e8 c4 8b ff ff       	call   c0102ab0 <__panic>

    struct vma_struct *vma = vma_create(0, PTSIZE, VM_WRITE);
c0109eec:	c7 44 24 08 02 00 00 	movl   $0x2,0x8(%esp)
c0109ef3:	00 
c0109ef4:	c7 44 24 04 00 00 40 	movl   $0x400000,0x4(%esp)
c0109efb:	00 
c0109efc:	c7 04 24 00 00 00 00 	movl   $0x0,(%esp)
c0109f03:	e8 1d f6 ff ff       	call   c0109525 <vma_create>
c0109f08:	89 45 e4             	mov    %eax,-0x1c(%ebp)
    assert(vma != NULL);
c0109f0b:	83 7d e4 00          	cmpl   $0x0,-0x1c(%ebp)
c0109f0f:	75 24                	jne    c0109f35 <check_pgfault+0xe0>
c0109f11:	c7 44 24 0c 34 cf 10 	movl   $0xc010cf34,0xc(%esp)
c0109f18:	c0 
c0109f19:	c7 44 24 08 3f ce 10 	movl   $0xc010ce3f,0x8(%esp)
c0109f20:	c0 
c0109f21:	c7 44 24 04 31 01 00 	movl   $0x131,0x4(%esp)
c0109f28:	00 
c0109f29:	c7 04 24 54 ce 10 c0 	movl   $0xc010ce54,(%esp)
c0109f30:	e8 7b 8b ff ff       	call   c0102ab0 <__panic>

    insert_vma_struct(mm, vma);
c0109f35:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0109f38:	89 44 24 04          	mov    %eax,0x4(%esp)
c0109f3c:	8b 45 dc             	mov    -0x24(%ebp),%eax
c0109f3f:	89 04 24             	mov    %eax,(%esp)
c0109f42:	e8 a0 f8 ff ff       	call   c01097e7 <insert_vma_struct>

    uintptr_t addr = 0x100;
c0109f47:	c7 45 e8 00 01 00 00 	movl   $0x100,-0x18(%ebp)
    assert(find_vma(mm, addr) == vma);
c0109f4e:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0109f51:	89 44 24 04          	mov    %eax,0x4(%esp)
c0109f55:	8b 45 dc             	mov    -0x24(%ebp),%eax
c0109f58:	89 04 24             	mov    %eax,(%esp)
c0109f5b:	e8 7c f6 ff ff       	call   c01095dc <find_vma>
c0109f60:	3b 45 e4             	cmp    -0x1c(%ebp),%eax
c0109f63:	74 24                	je     c0109f89 <check_pgfault+0x134>
c0109f65:	c7 44 24 0c 09 d0 10 	movl   $0xc010d009,0xc(%esp)
c0109f6c:	c0 
c0109f6d:	c7 44 24 08 3f ce 10 	movl   $0xc010ce3f,0x8(%esp)
c0109f74:	c0 
c0109f75:	c7 44 24 04 36 01 00 	movl   $0x136,0x4(%esp)
c0109f7c:	00 
c0109f7d:	c7 04 24 54 ce 10 c0 	movl   $0xc010ce54,(%esp)
c0109f84:	e8 27 8b ff ff       	call   c0102ab0 <__panic>

    int i, sum = 0;
c0109f89:	c7 45 f0 00 00 00 00 	movl   $0x0,-0x10(%ebp)
    for (i = 0; i < 100; i ++) {
c0109f90:	c7 45 ec 00 00 00 00 	movl   $0x0,-0x14(%ebp)
c0109f97:	eb 15                	jmp    c0109fae <check_pgfault+0x159>
        *(char *)(addr + i) = i;
c0109f99:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0109f9c:	03 45 e8             	add    -0x18(%ebp),%eax
c0109f9f:	8b 55 ec             	mov    -0x14(%ebp),%edx
c0109fa2:	88 10                	mov    %dl,(%eax)
        sum += i;
c0109fa4:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0109fa7:	01 45 f0             	add    %eax,-0x10(%ebp)

    uintptr_t addr = 0x100;
    assert(find_vma(mm, addr) == vma);

    int i, sum = 0;
    for (i = 0; i < 100; i ++) {
c0109faa:	83 45 ec 01          	addl   $0x1,-0x14(%ebp)
c0109fae:	83 7d ec 63          	cmpl   $0x63,-0x14(%ebp)
c0109fb2:	7e e5                	jle    c0109f99 <check_pgfault+0x144>
        *(char *)(addr + i) = i;
        sum += i;
    }
    for (i = 0; i < 100; i ++) {
c0109fb4:	c7 45 ec 00 00 00 00 	movl   $0x0,-0x14(%ebp)
c0109fbb:	eb 13                	jmp    c0109fd0 <check_pgfault+0x17b>
        sum -= *(char *)(addr + i);
c0109fbd:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0109fc0:	03 45 e8             	add    -0x18(%ebp),%eax
c0109fc3:	0f b6 00             	movzbl (%eax),%eax
c0109fc6:	0f be c0             	movsbl %al,%eax
c0109fc9:	29 45 f0             	sub    %eax,-0x10(%ebp)
    int i, sum = 0;
    for (i = 0; i < 100; i ++) {
        *(char *)(addr + i) = i;
        sum += i;
    }
    for (i = 0; i < 100; i ++) {
c0109fcc:	83 45 ec 01          	addl   $0x1,-0x14(%ebp)
c0109fd0:	83 7d ec 63          	cmpl   $0x63,-0x14(%ebp)
c0109fd4:	7e e7                	jle    c0109fbd <check_pgfault+0x168>
        sum -= *(char *)(addr + i);
    }
    assert(sum == 0);
c0109fd6:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
c0109fda:	74 24                	je     c010a000 <check_pgfault+0x1ab>
c0109fdc:	c7 44 24 0c 23 d0 10 	movl   $0xc010d023,0xc(%esp)
c0109fe3:	c0 
c0109fe4:	c7 44 24 08 3f ce 10 	movl   $0xc010ce3f,0x8(%esp)
c0109feb:	c0 
c0109fec:	c7 44 24 04 40 01 00 	movl   $0x140,0x4(%esp)
c0109ff3:	00 
c0109ff4:	c7 04 24 54 ce 10 c0 	movl   $0xc010ce54,(%esp)
c0109ffb:	e8 b0 8a ff ff       	call   c0102ab0 <__panic>

    page_remove(pgdir, ROUNDDOWN(addr, PGSIZE));
c010a000:	8b 45 e8             	mov    -0x18(%ebp),%eax
c010a003:	89 45 f4             	mov    %eax,-0xc(%ebp)
c010a006:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010a009:	25 00 f0 ff ff       	and    $0xfffff000,%eax
c010a00e:	89 44 24 04          	mov    %eax,0x4(%esp)
c010a012:	8b 45 e0             	mov    -0x20(%ebp),%eax
c010a015:	89 04 24             	mov    %eax,(%esp)
c010a018:	e8 d1 c8 ff ff       	call   c01068ee <page_remove>
    free_page(pa2page(pgdir[0]));
c010a01d:	8b 45 e0             	mov    -0x20(%ebp),%eax
c010a020:	8b 00                	mov    (%eax),%eax
c010a022:	89 04 24             	mov    %eax,(%esp)
c010a025:	e8 4a f4 ff ff       	call   c0109474 <pa2page>
c010a02a:	c7 44 24 04 01 00 00 	movl   $0x1,0x4(%esp)
c010a031:	00 
c010a032:	89 04 24             	mov    %eax,(%esp)
c010a035:	e8 c5 bf ff ff       	call   c0105fff <free_pages>
    pgdir[0] = 0;
c010a03a:	8b 45 e0             	mov    -0x20(%ebp),%eax
c010a03d:	c7 00 00 00 00 00    	movl   $0x0,(%eax)

    mm->pgdir = NULL;
c010a043:	8b 45 dc             	mov    -0x24(%ebp),%eax
c010a046:	c7 40 10 00 00 00 00 	movl   $0x0,0x10(%eax)
    mm_destroy(mm);
c010a04d:	8b 45 dc             	mov    -0x24(%ebp),%eax
c010a050:	89 04 24             	mov    %eax,(%esp)
c010a053:	e8 6e f9 ff ff       	call   c01099c6 <mm_destroy>
    check_mm_struct = NULL;
c010a058:	c7 05 b8 8c 12 c0 00 	movl   $0x0,0xc0128cb8
c010a05f:	00 00 00 

    assert(nr_free_pages_store == nr_free_pages());
c010a062:	e8 ca bf ff ff       	call   c0106031 <nr_free_pages>
c010a067:	3b 45 d4             	cmp    -0x2c(%ebp),%eax
c010a06a:	74 24                	je     c010a090 <check_pgfault+0x23b>
c010a06c:	c7 44 24 0c c0 ce 10 	movl   $0xc010cec0,0xc(%esp)
c010a073:	c0 
c010a074:	c7 44 24 08 3f ce 10 	movl   $0xc010ce3f,0x8(%esp)
c010a07b:	c0 
c010a07c:	c7 44 24 04 4a 01 00 	movl   $0x14a,0x4(%esp)
c010a083:	00 
c010a084:	c7 04 24 54 ce 10 c0 	movl   $0xc010ce54,(%esp)
c010a08b:	e8 20 8a ff ff       	call   c0102ab0 <__panic>
    assert(slab_allocated_store == slab_allocated());
c010a090:	e8 8e d8 ff ff       	call   c0107923 <slab_allocated>
c010a095:	3b 45 d8             	cmp    -0x28(%ebp),%eax
c010a098:	74 24                	je     c010a0be <check_pgfault+0x269>
c010a09a:	c7 44 24 0c e8 ce 10 	movl   $0xc010cee8,0xc(%esp)
c010a0a1:	c0 
c010a0a2:	c7 44 24 08 3f ce 10 	movl   $0xc010ce3f,0x8(%esp)
c010a0a9:	c0 
c010a0aa:	c7 44 24 04 4b 01 00 	movl   $0x14b,0x4(%esp)
c010a0b1:	00 
c010a0b2:	c7 04 24 54 ce 10 c0 	movl   $0xc010ce54,(%esp)
c010a0b9:	e8 f2 89 ff ff       	call   c0102ab0 <__panic>

    cprintf("check_pgfault() succeeded!\n");
c010a0be:	c7 04 24 2c d0 10 c0 	movl   $0xc010d02c,(%esp)
c010a0c5:	e8 02 75 ff ff       	call   c01015cc <cprintf>
}
c010a0ca:	c9                   	leave  
c010a0cb:	c3                   	ret    

c010a0cc <do_pgfault>:

// do_pgfault - interrupt handler to process the page fault execption
int
do_pgfault(struct mm_struct *mm, uint32_t error_code, uintptr_t addr) {
c010a0cc:	55                   	push   %ebp
c010a0cd:	89 e5                	mov    %esp,%ebp
c010a0cf:	83 ec 28             	sub    $0x28,%esp
    int ret = -E_INVAL;
c010a0d2:	c7 45 e8 fd ff ff ff 	movl   $0xfffffffd,-0x18(%ebp)
    struct vma_struct *vma = find_vma(mm, addr);
c010a0d9:	8b 45 10             	mov    0x10(%ebp),%eax
c010a0dc:	89 44 24 04          	mov    %eax,0x4(%esp)
c010a0e0:	8b 45 08             	mov    0x8(%ebp),%eax
c010a0e3:	89 04 24             	mov    %eax,(%esp)
c010a0e6:	e8 f1 f4 ff ff       	call   c01095dc <find_vma>
c010a0eb:	89 45 ec             	mov    %eax,-0x14(%ebp)
    if (vma == NULL || vma->vm_start > addr) {
c010a0ee:	83 7d ec 00          	cmpl   $0x0,-0x14(%ebp)
c010a0f2:	0f 84 9d 00 00 00    	je     c010a195 <do_pgfault+0xc9>
c010a0f8:	8b 45 ec             	mov    -0x14(%ebp),%eax
c010a0fb:	8b 40 04             	mov    0x4(%eax),%eax
c010a0fe:	3b 45 10             	cmp    0x10(%ebp),%eax
c010a101:	0f 87 8e 00 00 00    	ja     c010a195 <do_pgfault+0xc9>
        goto failed;
    }

    switch (error_code & 3) {
c010a107:	8b 45 0c             	mov    0xc(%ebp),%eax
c010a10a:	83 e0 03             	and    $0x3,%eax
c010a10d:	85 c0                	test   %eax,%eax
c010a10f:	74 14                	je     c010a125 <do_pgfault+0x59>
c010a111:	83 f8 01             	cmp    $0x1,%eax
c010a114:	74 78                	je     c010a18e <do_pgfault+0xc2>
    default:
            /* default is 3: write, present */
    case 2: /* write, not present */
        if (!(vma->vm_flags & VM_WRITE)) {
c010a116:	8b 45 ec             	mov    -0x14(%ebp),%eax
c010a119:	8b 40 0c             	mov    0xc(%eax),%eax
c010a11c:	83 e0 02             	and    $0x2,%eax
c010a11f:	85 c0                	test   %eax,%eax
c010a121:	75 11                	jne    c010a134 <do_pgfault+0x68>
            goto failed;
c010a123:	eb 70                	jmp    c010a195 <do_pgfault+0xc9>
        }
        break;
    case 1: /* read, present */
        goto failed;
    case 0: /* read, not present */
        if (!(vma->vm_flags & (VM_READ | VM_EXEC))) {
c010a125:	8b 45 ec             	mov    -0x14(%ebp),%eax
c010a128:	8b 40 0c             	mov    0xc(%eax),%eax
c010a12b:	83 e0 05             	and    $0x5,%eax
c010a12e:	85 c0                	test   %eax,%eax
c010a130:	74 5f                	je     c010a191 <do_pgfault+0xc5>
c010a132:	eb 01                	jmp    c010a135 <do_pgfault+0x69>
            /* default is 3: write, present */
    case 2: /* write, not present */
        if (!(vma->vm_flags & VM_WRITE)) {
            goto failed;
        }
        break;
c010a134:	90                   	nop
        if (!(vma->vm_flags & (VM_READ | VM_EXEC))) {
            goto failed;
        }
    }

    uint32_t perm = PTE_U;
c010a135:	c7 45 f0 04 00 00 00 	movl   $0x4,-0x10(%ebp)
    if (vma->vm_flags & VM_WRITE) {
c010a13c:	8b 45 ec             	mov    -0x14(%ebp),%eax
c010a13f:	8b 40 0c             	mov    0xc(%eax),%eax
c010a142:	83 e0 02             	and    $0x2,%eax
c010a145:	85 c0                	test   %eax,%eax
c010a147:	74 04                	je     c010a14d <do_pgfault+0x81>
        perm |= PTE_W;
c010a149:	83 4d f0 02          	orl    $0x2,-0x10(%ebp)
    }
    addr = ROUNDDOWN(addr, PGSIZE);
c010a14d:	8b 45 10             	mov    0x10(%ebp),%eax
c010a150:	89 45 f4             	mov    %eax,-0xc(%ebp)
c010a153:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010a156:	25 00 f0 ff ff       	and    $0xfffff000,%eax
c010a15b:	89 45 10             	mov    %eax,0x10(%ebp)

    ret = -E_NO_MEM;
c010a15e:	c7 45 e8 fc ff ff ff 	movl   $0xfffffffc,-0x18(%ebp)

    if (pgdir_alloc_page(mm->pgdir, addr, perm) == 0) {
c010a165:	8b 45 08             	mov    0x8(%ebp),%eax
c010a168:	8b 40 10             	mov    0x10(%eax),%eax
c010a16b:	8b 55 f0             	mov    -0x10(%ebp),%edx
c010a16e:	89 54 24 08          	mov    %edx,0x8(%esp)
c010a172:	8b 55 10             	mov    0x10(%ebp),%edx
c010a175:	89 54 24 04          	mov    %edx,0x4(%esp)
c010a179:	89 04 24             	mov    %eax,(%esp)
c010a17c:	e8 c7 c8 ff ff       	call   c0106a48 <pgdir_alloc_page>
c010a181:	85 c0                	test   %eax,%eax
c010a183:	74 0f                	je     c010a194 <do_pgfault+0xc8>
        goto failed;
    }
    ret = 0;
c010a185:	c7 45 e8 00 00 00 00 	movl   $0x0,-0x18(%ebp)
c010a18c:	eb 07                	jmp    c010a195 <do_pgfault+0xc9>
        if (!(vma->vm_flags & VM_WRITE)) {
            goto failed;
        }
        break;
    case 1: /* read, present */
        goto failed;
c010a18e:	90                   	nop
c010a18f:	eb 04                	jmp    c010a195 <do_pgfault+0xc9>
    case 0: /* read, not present */
        if (!(vma->vm_flags & (VM_READ | VM_EXEC))) {
            goto failed;
c010a191:	90                   	nop
c010a192:	eb 01                	jmp    c010a195 <do_pgfault+0xc9>
    addr = ROUNDDOWN(addr, PGSIZE);

    ret = -E_NO_MEM;

    if (pgdir_alloc_page(mm->pgdir, addr, perm) == 0) {
        goto failed;
c010a194:	90                   	nop
    }
    ret = 0;

failed:
    return ret;
c010a195:	8b 45 e8             	mov    -0x18(%ebp),%eax
}
c010a198:	c9                   	leave  
c010a199:	c3                   	ret    
	...

c010a19c <printnum>:
 * @width:      maximum number of digits, if the actual width is less than @width, use @padc instead
 * @padc:       character that padded on the left if the actual width is less than @width
 * */
static void
printnum(void (*putch)(int, void*), void *putdat,
        unsigned long long num, unsigned base, int width, int padc) {
c010a19c:	55                   	push   %ebp
c010a19d:	89 e5                	mov    %esp,%ebp
c010a19f:	83 ec 58             	sub    $0x58,%esp
c010a1a2:	8b 45 10             	mov    0x10(%ebp),%eax
c010a1a5:	89 45 d0             	mov    %eax,-0x30(%ebp)
c010a1a8:	8b 45 14             	mov    0x14(%ebp),%eax
c010a1ab:	89 45 d4             	mov    %eax,-0x2c(%ebp)
    unsigned long long result = num;
c010a1ae:	8b 45 d0             	mov    -0x30(%ebp),%eax
c010a1b1:	8b 55 d4             	mov    -0x2c(%ebp),%edx
c010a1b4:	89 45 d8             	mov    %eax,-0x28(%ebp)
c010a1b7:	89 55 dc             	mov    %edx,-0x24(%ebp)
    unsigned mod = do_div(result, base);
c010a1ba:	8b 45 18             	mov    0x18(%ebp),%eax
c010a1bd:	89 45 f4             	mov    %eax,-0xc(%ebp)
c010a1c0:	8b 45 d8             	mov    -0x28(%ebp),%eax
c010a1c3:	8b 55 dc             	mov    -0x24(%ebp),%edx
c010a1c6:	89 45 e8             	mov    %eax,-0x18(%ebp)
c010a1c9:	89 55 ec             	mov    %edx,-0x14(%ebp)
c010a1cc:	8b 45 ec             	mov    -0x14(%ebp),%eax
c010a1cf:	89 45 e4             	mov    %eax,-0x1c(%ebp)
c010a1d2:	83 7d ec 00          	cmpl   $0x0,-0x14(%ebp)
c010a1d6:	74 1c                	je     c010a1f4 <printnum+0x58>
c010a1d8:	8b 45 ec             	mov    -0x14(%ebp),%eax
c010a1db:	ba 00 00 00 00       	mov    $0x0,%edx
c010a1e0:	f7 75 f4             	divl   -0xc(%ebp)
c010a1e3:	89 55 e4             	mov    %edx,-0x1c(%ebp)
c010a1e6:	8b 45 ec             	mov    -0x14(%ebp),%eax
c010a1e9:	ba 00 00 00 00       	mov    $0x0,%edx
c010a1ee:	f7 75 f4             	divl   -0xc(%ebp)
c010a1f1:	89 45 ec             	mov    %eax,-0x14(%ebp)
c010a1f4:	8b 45 e8             	mov    -0x18(%ebp),%eax
c010a1f7:	8b 55 e4             	mov    -0x1c(%ebp),%edx
c010a1fa:	f7 75 f4             	divl   -0xc(%ebp)
c010a1fd:	89 45 e8             	mov    %eax,-0x18(%ebp)
c010a200:	89 55 f0             	mov    %edx,-0x10(%ebp)
c010a203:	8b 45 e8             	mov    -0x18(%ebp),%eax
c010a206:	8b 55 ec             	mov    -0x14(%ebp),%edx
c010a209:	89 45 d8             	mov    %eax,-0x28(%ebp)
c010a20c:	89 55 dc             	mov    %edx,-0x24(%ebp)
c010a20f:	8b 45 f0             	mov    -0x10(%ebp),%eax
c010a212:	89 45 e0             	mov    %eax,-0x20(%ebp)

    // first recursively print all preceding (more significant) digits
    if (num >= base) {
c010a215:	8b 45 18             	mov    0x18(%ebp),%eax
c010a218:	ba 00 00 00 00       	mov    $0x0,%edx
c010a21d:	3b 55 d4             	cmp    -0x2c(%ebp),%edx
c010a220:	77 56                	ja     c010a278 <printnum+0xdc>
c010a222:	3b 55 d4             	cmp    -0x2c(%ebp),%edx
c010a225:	72 05                	jb     c010a22c <printnum+0x90>
c010a227:	3b 45 d0             	cmp    -0x30(%ebp),%eax
c010a22a:	77 4c                	ja     c010a278 <printnum+0xdc>
        printnum(putch, putdat, result, base, width - 1, padc);
c010a22c:	8b 45 1c             	mov    0x1c(%ebp),%eax
c010a22f:	8d 50 ff             	lea    -0x1(%eax),%edx
c010a232:	8b 45 20             	mov    0x20(%ebp),%eax
c010a235:	89 44 24 18          	mov    %eax,0x18(%esp)
c010a239:	89 54 24 14          	mov    %edx,0x14(%esp)
c010a23d:	8b 45 18             	mov    0x18(%ebp),%eax
c010a240:	89 44 24 10          	mov    %eax,0x10(%esp)
c010a244:	8b 45 d8             	mov    -0x28(%ebp),%eax
c010a247:	8b 55 dc             	mov    -0x24(%ebp),%edx
c010a24a:	89 44 24 08          	mov    %eax,0x8(%esp)
c010a24e:	89 54 24 0c          	mov    %edx,0xc(%esp)
c010a252:	8b 45 0c             	mov    0xc(%ebp),%eax
c010a255:	89 44 24 04          	mov    %eax,0x4(%esp)
c010a259:	8b 45 08             	mov    0x8(%ebp),%eax
c010a25c:	89 04 24             	mov    %eax,(%esp)
c010a25f:	e8 38 ff ff ff       	call   c010a19c <printnum>
c010a264:	eb 1c                	jmp    c010a282 <printnum+0xe6>
    } else {
        // print any needed pad characters before first digit
        while (-- width > 0)
            putch(padc, putdat);
c010a266:	8b 45 0c             	mov    0xc(%ebp),%eax
c010a269:	89 44 24 04          	mov    %eax,0x4(%esp)
c010a26d:	8b 45 20             	mov    0x20(%ebp),%eax
c010a270:	89 04 24             	mov    %eax,(%esp)
c010a273:	8b 45 08             	mov    0x8(%ebp),%eax
c010a276:	ff d0                	call   *%eax
    // first recursively print all preceding (more significant) digits
    if (num >= base) {
        printnum(putch, putdat, result, base, width - 1, padc);
    } else {
        // print any needed pad characters before first digit
        while (-- width > 0)
c010a278:	83 6d 1c 01          	subl   $0x1,0x1c(%ebp)
c010a27c:	83 7d 1c 00          	cmpl   $0x0,0x1c(%ebp)
c010a280:	7f e4                	jg     c010a266 <printnum+0xca>
            putch(padc, putdat);
    }
    // then print this (the least significant) digit
    putch("0123456789abcdef"[mod], putdat);
c010a282:	8b 45 e0             	mov    -0x20(%ebp),%eax
c010a285:	0f b6 80 c8 d0 10 c0 	movzbl -0x3fef2f38(%eax),%eax
c010a28c:	0f be c0             	movsbl %al,%eax
c010a28f:	8b 55 0c             	mov    0xc(%ebp),%edx
c010a292:	89 54 24 04          	mov    %edx,0x4(%esp)
c010a296:	89 04 24             	mov    %eax,(%esp)
c010a299:	8b 45 08             	mov    0x8(%ebp),%eax
c010a29c:	ff d0                	call   *%eax
}
c010a29e:	c9                   	leave  
c010a29f:	c3                   	ret    

c010a2a0 <getuint>:
 * getuint - get an unsigned int of various possible sizes from a varargs list
 * @ap:         a varargs list pointer
 * @lflag:      determines the size of the vararg that @ap points to
 * */
static unsigned long long
getuint(va_list *ap, int lflag) {
c010a2a0:	55                   	push   %ebp
c010a2a1:	89 e5                	mov    %esp,%ebp
    if (lflag >= 2) {
c010a2a3:	83 7d 0c 01          	cmpl   $0x1,0xc(%ebp)
c010a2a7:	7e 14                	jle    c010a2bd <getuint+0x1d>
        return va_arg(*ap, unsigned long long);
c010a2a9:	8b 45 08             	mov    0x8(%ebp),%eax
c010a2ac:	8b 00                	mov    (%eax),%eax
c010a2ae:	8d 48 08             	lea    0x8(%eax),%ecx
c010a2b1:	8b 55 08             	mov    0x8(%ebp),%edx
c010a2b4:	89 0a                	mov    %ecx,(%edx)
c010a2b6:	8b 50 04             	mov    0x4(%eax),%edx
c010a2b9:	8b 00                	mov    (%eax),%eax
c010a2bb:	eb 30                	jmp    c010a2ed <getuint+0x4d>
    }
    else if (lflag) {
c010a2bd:	83 7d 0c 00          	cmpl   $0x0,0xc(%ebp)
c010a2c1:	74 16                	je     c010a2d9 <getuint+0x39>
        return va_arg(*ap, unsigned long);
c010a2c3:	8b 45 08             	mov    0x8(%ebp),%eax
c010a2c6:	8b 00                	mov    (%eax),%eax
c010a2c8:	8d 48 04             	lea    0x4(%eax),%ecx
c010a2cb:	8b 55 08             	mov    0x8(%ebp),%edx
c010a2ce:	89 0a                	mov    %ecx,(%edx)
c010a2d0:	8b 00                	mov    (%eax),%eax
c010a2d2:	ba 00 00 00 00       	mov    $0x0,%edx
c010a2d7:	eb 14                	jmp    c010a2ed <getuint+0x4d>
    }
    else {
        return va_arg(*ap, unsigned int);
c010a2d9:	8b 45 08             	mov    0x8(%ebp),%eax
c010a2dc:	8b 00                	mov    (%eax),%eax
c010a2de:	8d 48 04             	lea    0x4(%eax),%ecx
c010a2e1:	8b 55 08             	mov    0x8(%ebp),%edx
c010a2e4:	89 0a                	mov    %ecx,(%edx)
c010a2e6:	8b 00                	mov    (%eax),%eax
c010a2e8:	ba 00 00 00 00       	mov    $0x0,%edx
    }
}
c010a2ed:	5d                   	pop    %ebp
c010a2ee:	c3                   	ret    

c010a2ef <getint>:
 * getint - same as getuint but signed, we can't use getuint because of sign extension
 * @ap:         a varargs list pointer
 * @lflag:      determines the size of the vararg that @ap points to
 * */
static long long
getint(va_list *ap, int lflag) {
c010a2ef:	55                   	push   %ebp
c010a2f0:	89 e5                	mov    %esp,%ebp
    if (lflag >= 2) {
c010a2f2:	83 7d 0c 01          	cmpl   $0x1,0xc(%ebp)
c010a2f6:	7e 14                	jle    c010a30c <getint+0x1d>
        return va_arg(*ap, long long);
c010a2f8:	8b 45 08             	mov    0x8(%ebp),%eax
c010a2fb:	8b 00                	mov    (%eax),%eax
c010a2fd:	8d 48 08             	lea    0x8(%eax),%ecx
c010a300:	8b 55 08             	mov    0x8(%ebp),%edx
c010a303:	89 0a                	mov    %ecx,(%edx)
c010a305:	8b 50 04             	mov    0x4(%eax),%edx
c010a308:	8b 00                	mov    (%eax),%eax
c010a30a:	eb 30                	jmp    c010a33c <getint+0x4d>
    }
    else if (lflag) {
c010a30c:	83 7d 0c 00          	cmpl   $0x0,0xc(%ebp)
c010a310:	74 16                	je     c010a328 <getint+0x39>
        return va_arg(*ap, long);
c010a312:	8b 45 08             	mov    0x8(%ebp),%eax
c010a315:	8b 00                	mov    (%eax),%eax
c010a317:	8d 48 04             	lea    0x4(%eax),%ecx
c010a31a:	8b 55 08             	mov    0x8(%ebp),%edx
c010a31d:	89 0a                	mov    %ecx,(%edx)
c010a31f:	8b 00                	mov    (%eax),%eax
c010a321:	89 c2                	mov    %eax,%edx
c010a323:	c1 fa 1f             	sar    $0x1f,%edx
c010a326:	eb 14                	jmp    c010a33c <getint+0x4d>
    }
    else {
        return va_arg(*ap, int);
c010a328:	8b 45 08             	mov    0x8(%ebp),%eax
c010a32b:	8b 00                	mov    (%eax),%eax
c010a32d:	8d 48 04             	lea    0x4(%eax),%ecx
c010a330:	8b 55 08             	mov    0x8(%ebp),%edx
c010a333:	89 0a                	mov    %ecx,(%edx)
c010a335:	8b 00                	mov    (%eax),%eax
c010a337:	89 c2                	mov    %eax,%edx
c010a339:	c1 fa 1f             	sar    $0x1f,%edx
    }
}
c010a33c:	5d                   	pop    %ebp
c010a33d:	c3                   	ret    

c010a33e <printfmt>:
 * @putch:      specified putch function, print a single character
 * @putdat:     used by @putch function
 * @fmt:        the format string to use
 * */
void
printfmt(void (*putch)(int, void*), void *putdat, const char *fmt, ...) {
c010a33e:	55                   	push   %ebp
c010a33f:	89 e5                	mov    %esp,%ebp
c010a341:	83 ec 28             	sub    $0x28,%esp
    va_list ap;

    va_start(ap, fmt);
c010a344:	8d 45 14             	lea    0x14(%ebp),%eax
c010a347:	89 45 f4             	mov    %eax,-0xc(%ebp)
    vprintfmt(putch, putdat, fmt, ap);
c010a34a:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010a34d:	89 44 24 0c          	mov    %eax,0xc(%esp)
c010a351:	8b 45 10             	mov    0x10(%ebp),%eax
c010a354:	89 44 24 08          	mov    %eax,0x8(%esp)
c010a358:	8b 45 0c             	mov    0xc(%ebp),%eax
c010a35b:	89 44 24 04          	mov    %eax,0x4(%esp)
c010a35f:	8b 45 08             	mov    0x8(%ebp),%eax
c010a362:	89 04 24             	mov    %eax,(%esp)
c010a365:	e8 02 00 00 00       	call   c010a36c <vprintfmt>
    va_end(ap);
}
c010a36a:	c9                   	leave  
c010a36b:	c3                   	ret    

c010a36c <vprintfmt>:
 *
 * Call this function if you are already dealing with a va_list.
 * Or you probably want printfmt() instead.
 * */
void
vprintfmt(void (*putch)(int, void*), void *putdat, const char *fmt, va_list ap) {
c010a36c:	55                   	push   %ebp
c010a36d:	89 e5                	mov    %esp,%ebp
c010a36f:	56                   	push   %esi
c010a370:	53                   	push   %ebx
c010a371:	83 ec 40             	sub    $0x40,%esp
    register int ch, err;
    unsigned long long num;
    int base, width, precision, lflag, altflag;

    while (1) {
        while ((ch = *(unsigned char *)fmt ++) != '%') {
c010a374:	eb 17                	jmp    c010a38d <vprintfmt+0x21>
            if (ch == '\0') {
c010a376:	85 db                	test   %ebx,%ebx
c010a378:	0f 84 e4 03 00 00    	je     c010a762 <vprintfmt+0x3f6>
                return;
            }
            putch(ch, putdat);
c010a37e:	8b 45 0c             	mov    0xc(%ebp),%eax
c010a381:	89 44 24 04          	mov    %eax,0x4(%esp)
c010a385:	89 1c 24             	mov    %ebx,(%esp)
c010a388:	8b 45 08             	mov    0x8(%ebp),%eax
c010a38b:	ff d0                	call   *%eax
    register int ch, err;
    unsigned long long num;
    int base, width, precision, lflag, altflag;

    while (1) {
        while ((ch = *(unsigned char *)fmt ++) != '%') {
c010a38d:	8b 45 10             	mov    0x10(%ebp),%eax
c010a390:	0f b6 00             	movzbl (%eax),%eax
c010a393:	0f b6 d8             	movzbl %al,%ebx
c010a396:	83 fb 25             	cmp    $0x25,%ebx
c010a399:	0f 95 c0             	setne  %al
c010a39c:	83 45 10 01          	addl   $0x1,0x10(%ebp)
c010a3a0:	84 c0                	test   %al,%al
c010a3a2:	75 d2                	jne    c010a376 <vprintfmt+0xa>
            }
            putch(ch, putdat);
        }

        // Process a %-escape sequence
        char padc = ' ';
c010a3a4:	c6 45 f7 20          	movb   $0x20,-0x9(%ebp)
        width = precision = -1;
c010a3a8:	c7 45 e8 ff ff ff ff 	movl   $0xffffffff,-0x18(%ebp)
c010a3af:	8b 45 e8             	mov    -0x18(%ebp),%eax
c010a3b2:	89 45 e4             	mov    %eax,-0x1c(%ebp)
        lflag = altflag = 0;
c010a3b5:	c7 45 f0 00 00 00 00 	movl   $0x0,-0x10(%ebp)
c010a3bc:	8b 45 f0             	mov    -0x10(%ebp),%eax
c010a3bf:	89 45 ec             	mov    %eax,-0x14(%ebp)
c010a3c2:	eb 04                	jmp    c010a3c8 <vprintfmt+0x5c>
            goto process_precision;

        case '.':
            if (width < 0)
                width = 0;
            goto reswitch;
c010a3c4:	90                   	nop
c010a3c5:	eb 01                	jmp    c010a3c8 <vprintfmt+0x5c>
            goto reswitch;

        process_precision:
            if (width < 0)
                width = precision, precision = -1;
            goto reswitch;
c010a3c7:	90                   	nop
        char padc = ' ';
        width = precision = -1;
        lflag = altflag = 0;

    reswitch:
        switch (ch = *(unsigned char *)fmt ++) {
c010a3c8:	8b 45 10             	mov    0x10(%ebp),%eax
c010a3cb:	0f b6 00             	movzbl (%eax),%eax
c010a3ce:	0f b6 d8             	movzbl %al,%ebx
c010a3d1:	89 d8                	mov    %ebx,%eax
c010a3d3:	83 45 10 01          	addl   $0x1,0x10(%ebp)
c010a3d7:	83 e8 23             	sub    $0x23,%eax
c010a3da:	83 f8 55             	cmp    $0x55,%eax
c010a3dd:	0f 87 4f 03 00 00    	ja     c010a732 <vprintfmt+0x3c6>
c010a3e3:	8b 04 85 ec d0 10 c0 	mov    -0x3fef2f14(,%eax,4),%eax
c010a3ea:	ff e0                	jmp    *%eax

        // flag to pad on the right
        case '-':
            padc = '-';
c010a3ec:	c6 45 f7 2d          	movb   $0x2d,-0x9(%ebp)
            goto reswitch;
c010a3f0:	eb d6                	jmp    c010a3c8 <vprintfmt+0x5c>

        // flag to pad with 0's instead of spaces
        case '0':
            padc = '0';
c010a3f2:	c6 45 f7 30          	movb   $0x30,-0x9(%ebp)
            goto reswitch;
c010a3f6:	eb d0                	jmp    c010a3c8 <vprintfmt+0x5c>

        // width field
        case '1' ... '9':
            for (precision = 0; ; ++ fmt) {
c010a3f8:	c7 45 e8 00 00 00 00 	movl   $0x0,-0x18(%ebp)
                precision = precision * 10 + ch - '0';
c010a3ff:	8b 55 e8             	mov    -0x18(%ebp),%edx
c010a402:	89 d0                	mov    %edx,%eax
c010a404:	c1 e0 02             	shl    $0x2,%eax
c010a407:	01 d0                	add    %edx,%eax
c010a409:	01 c0                	add    %eax,%eax
c010a40b:	01 d8                	add    %ebx,%eax
c010a40d:	83 e8 30             	sub    $0x30,%eax
c010a410:	89 45 e8             	mov    %eax,-0x18(%ebp)
                ch = *fmt;
c010a413:	8b 45 10             	mov    0x10(%ebp),%eax
c010a416:	0f b6 00             	movzbl (%eax),%eax
c010a419:	0f be d8             	movsbl %al,%ebx
                if (ch < '0' || ch > '9') {
c010a41c:	83 fb 2f             	cmp    $0x2f,%ebx
c010a41f:	7e 39                	jle    c010a45a <vprintfmt+0xee>
c010a421:	83 fb 39             	cmp    $0x39,%ebx
c010a424:	7f 37                	jg     c010a45d <vprintfmt+0xf1>
            padc = '0';
            goto reswitch;

        // width field
        case '1' ... '9':
            for (precision = 0; ; ++ fmt) {
c010a426:	83 45 10 01          	addl   $0x1,0x10(%ebp)
                precision = precision * 10 + ch - '0';
                ch = *fmt;
                if (ch < '0' || ch > '9') {
                    break;
                }
            }
c010a42a:	eb d3                	jmp    c010a3ff <vprintfmt+0x93>
            goto process_precision;

        case '*':
            precision = va_arg(ap, int);
c010a42c:	8b 45 14             	mov    0x14(%ebp),%eax
c010a42f:	8d 50 04             	lea    0x4(%eax),%edx
c010a432:	89 55 14             	mov    %edx,0x14(%ebp)
c010a435:	8b 00                	mov    (%eax),%eax
c010a437:	89 45 e8             	mov    %eax,-0x18(%ebp)
            goto process_precision;
c010a43a:	eb 22                	jmp    c010a45e <vprintfmt+0xf2>

        case '.':
            if (width < 0)
c010a43c:	83 7d e4 00          	cmpl   $0x0,-0x1c(%ebp)
c010a440:	79 82                	jns    c010a3c4 <vprintfmt+0x58>
                width = 0;
c010a442:	c7 45 e4 00 00 00 00 	movl   $0x0,-0x1c(%ebp)
            goto reswitch;
c010a449:	e9 7a ff ff ff       	jmp    c010a3c8 <vprintfmt+0x5c>

        case '#':
            altflag = 1;
c010a44e:	c7 45 f0 01 00 00 00 	movl   $0x1,-0x10(%ebp)
            goto reswitch;
c010a455:	e9 6e ff ff ff       	jmp    c010a3c8 <vprintfmt+0x5c>
                ch = *fmt;
                if (ch < '0' || ch > '9') {
                    break;
                }
            }
            goto process_precision;
c010a45a:	90                   	nop
c010a45b:	eb 01                	jmp    c010a45e <vprintfmt+0xf2>
c010a45d:	90                   	nop
        case '#':
            altflag = 1;
            goto reswitch;

        process_precision:
            if (width < 0)
c010a45e:	83 7d e4 00          	cmpl   $0x0,-0x1c(%ebp)
c010a462:	0f 89 5f ff ff ff    	jns    c010a3c7 <vprintfmt+0x5b>
                width = precision, precision = -1;
c010a468:	8b 45 e8             	mov    -0x18(%ebp),%eax
c010a46b:	89 45 e4             	mov    %eax,-0x1c(%ebp)
c010a46e:	c7 45 e8 ff ff ff ff 	movl   $0xffffffff,-0x18(%ebp)
            goto reswitch;
c010a475:	e9 4e ff ff ff       	jmp    c010a3c8 <vprintfmt+0x5c>

        // long flag (doubled for long long)
        case 'l':
            lflag ++;
c010a47a:	83 45 ec 01          	addl   $0x1,-0x14(%ebp)
            goto reswitch;
c010a47e:	e9 45 ff ff ff       	jmp    c010a3c8 <vprintfmt+0x5c>

        // character
        case 'c':
            putch(va_arg(ap, int), putdat);
c010a483:	8b 45 14             	mov    0x14(%ebp),%eax
c010a486:	8d 50 04             	lea    0x4(%eax),%edx
c010a489:	89 55 14             	mov    %edx,0x14(%ebp)
c010a48c:	8b 00                	mov    (%eax),%eax
c010a48e:	8b 55 0c             	mov    0xc(%ebp),%edx
c010a491:	89 54 24 04          	mov    %edx,0x4(%esp)
c010a495:	89 04 24             	mov    %eax,(%esp)
c010a498:	8b 45 08             	mov    0x8(%ebp),%eax
c010a49b:	ff d0                	call   *%eax
            break;
c010a49d:	e9 ba 02 00 00       	jmp    c010a75c <vprintfmt+0x3f0>

        // error message
        case 'e':
            err = va_arg(ap, int);
c010a4a2:	8b 45 14             	mov    0x14(%ebp),%eax
c010a4a5:	8d 50 04             	lea    0x4(%eax),%edx
c010a4a8:	89 55 14             	mov    %edx,0x14(%ebp)
c010a4ab:	8b 18                	mov    (%eax),%ebx
            if (err < 0) {
c010a4ad:	85 db                	test   %ebx,%ebx
c010a4af:	79 02                	jns    c010a4b3 <vprintfmt+0x147>
                err = -err;
c010a4b1:	f7 db                	neg    %ebx
            }
            if (err > MAXERROR || (p = error_string[err]) == NULL) {
c010a4b3:	83 fb 06             	cmp    $0x6,%ebx
c010a4b6:	7f 0d                	jg     c010a4c5 <vprintfmt+0x159>
c010a4b8:	89 d8                	mov    %ebx,%eax
c010a4ba:	8b 34 85 ac d0 10 c0 	mov    -0x3fef2f54(,%eax,4),%esi
c010a4c1:	85 f6                	test   %esi,%esi
c010a4c3:	75 24                	jne    c010a4e9 <vprintfmt+0x17d>
                printfmt(putch, putdat, "error %d", err);
c010a4c5:	89 5c 24 0c          	mov    %ebx,0xc(%esp)
c010a4c9:	c7 44 24 08 d9 d0 10 	movl   $0xc010d0d9,0x8(%esp)
c010a4d0:	c0 
c010a4d1:	8b 45 0c             	mov    0xc(%ebp),%eax
c010a4d4:	89 44 24 04          	mov    %eax,0x4(%esp)
c010a4d8:	8b 45 08             	mov    0x8(%ebp),%eax
c010a4db:	89 04 24             	mov    %eax,(%esp)
c010a4de:	e8 5b fe ff ff       	call   c010a33e <printfmt>
        case 'e':
            err = va_arg(ap, int);
            if (err < 0) {
                err = -err;
            }
            if (err > MAXERROR || (p = error_string[err]) == NULL) {
c010a4e3:	90                   	nop
                printfmt(putch, putdat, "error %d", err);
            }
            else {
                printfmt(putch, putdat, "%s", p);
            }
            break;
c010a4e4:	e9 73 02 00 00       	jmp    c010a75c <vprintfmt+0x3f0>
            }
            if (err > MAXERROR || (p = error_string[err]) == NULL) {
                printfmt(putch, putdat, "error %d", err);
            }
            else {
                printfmt(putch, putdat, "%s", p);
c010a4e9:	89 74 24 0c          	mov    %esi,0xc(%esp)
c010a4ed:	c7 44 24 08 e2 d0 10 	movl   $0xc010d0e2,0x8(%esp)
c010a4f4:	c0 
c010a4f5:	8b 45 0c             	mov    0xc(%ebp),%eax
c010a4f8:	89 44 24 04          	mov    %eax,0x4(%esp)
c010a4fc:	8b 45 08             	mov    0x8(%ebp),%eax
c010a4ff:	89 04 24             	mov    %eax,(%esp)
c010a502:	e8 37 fe ff ff       	call   c010a33e <printfmt>
            }
            break;
c010a507:	e9 50 02 00 00       	jmp    c010a75c <vprintfmt+0x3f0>

        // string
        case 's':
            if ((p = va_arg(ap, char *)) == NULL) {
c010a50c:	8b 45 14             	mov    0x14(%ebp),%eax
c010a50f:	8d 50 04             	lea    0x4(%eax),%edx
c010a512:	89 55 14             	mov    %edx,0x14(%ebp)
c010a515:	8b 30                	mov    (%eax),%esi
c010a517:	85 f6                	test   %esi,%esi
c010a519:	75 05                	jne    c010a520 <vprintfmt+0x1b4>
                p = "(null)";
c010a51b:	be e5 d0 10 c0       	mov    $0xc010d0e5,%esi
            }
            if (width > 0 && padc != '-') {
c010a520:	83 7d e4 00          	cmpl   $0x0,-0x1c(%ebp)
c010a524:	7e 7c                	jle    c010a5a2 <vprintfmt+0x236>
c010a526:	80 7d f7 2d          	cmpb   $0x2d,-0x9(%ebp)
c010a52a:	74 79                	je     c010a5a5 <vprintfmt+0x239>
                for (width -= strnlen(p, precision); width > 0; width --) {
c010a52c:	8b 5d e4             	mov    -0x1c(%ebp),%ebx
c010a52f:	8b 45 e8             	mov    -0x18(%ebp),%eax
c010a532:	89 44 24 04          	mov    %eax,0x4(%esp)
c010a536:	89 34 24             	mov    %esi,(%esp)
c010a539:	e8 fd 03 00 00       	call   c010a93b <strnlen>
c010a53e:	89 da                	mov    %ebx,%edx
c010a540:	29 c2                	sub    %eax,%edx
c010a542:	89 d0                	mov    %edx,%eax
c010a544:	89 45 e4             	mov    %eax,-0x1c(%ebp)
c010a547:	eb 17                	jmp    c010a560 <vprintfmt+0x1f4>
                    putch(padc, putdat);
c010a549:	0f be 45 f7          	movsbl -0x9(%ebp),%eax
c010a54d:	8b 55 0c             	mov    0xc(%ebp),%edx
c010a550:	89 54 24 04          	mov    %edx,0x4(%esp)
c010a554:	89 04 24             	mov    %eax,(%esp)
c010a557:	8b 45 08             	mov    0x8(%ebp),%eax
c010a55a:	ff d0                	call   *%eax
        case 's':
            if ((p = va_arg(ap, char *)) == NULL) {
                p = "(null)";
            }
            if (width > 0 && padc != '-') {
                for (width -= strnlen(p, precision); width > 0; width --) {
c010a55c:	83 6d e4 01          	subl   $0x1,-0x1c(%ebp)
c010a560:	83 7d e4 00          	cmpl   $0x0,-0x1c(%ebp)
c010a564:	7f e3                	jg     c010a549 <vprintfmt+0x1dd>
                    putch(padc, putdat);
                }
            }
            for (; (ch = *p ++) != '\0' && (precision < 0 || -- precision >= 0); width --) {
c010a566:	eb 3e                	jmp    c010a5a6 <vprintfmt+0x23a>
                if (altflag && (ch < ' ' || ch > '~')) {
c010a568:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
c010a56c:	74 1f                	je     c010a58d <vprintfmt+0x221>
c010a56e:	83 fb 1f             	cmp    $0x1f,%ebx
c010a571:	7e 05                	jle    c010a578 <vprintfmt+0x20c>
c010a573:	83 fb 7e             	cmp    $0x7e,%ebx
c010a576:	7e 15                	jle    c010a58d <vprintfmt+0x221>
                    putch('?', putdat);
c010a578:	8b 45 0c             	mov    0xc(%ebp),%eax
c010a57b:	89 44 24 04          	mov    %eax,0x4(%esp)
c010a57f:	c7 04 24 3f 00 00 00 	movl   $0x3f,(%esp)
c010a586:	8b 45 08             	mov    0x8(%ebp),%eax
c010a589:	ff d0                	call   *%eax
                for (width -= strnlen(p, precision); width > 0; width --) {
                    putch(padc, putdat);
                }
            }
            for (; (ch = *p ++) != '\0' && (precision < 0 || -- precision >= 0); width --) {
                if (altflag && (ch < ' ' || ch > '~')) {
c010a58b:	eb 0f                	jmp    c010a59c <vprintfmt+0x230>
                    putch('?', putdat);
                }
                else {
                    putch(ch, putdat);
c010a58d:	8b 45 0c             	mov    0xc(%ebp),%eax
c010a590:	89 44 24 04          	mov    %eax,0x4(%esp)
c010a594:	89 1c 24             	mov    %ebx,(%esp)
c010a597:	8b 45 08             	mov    0x8(%ebp),%eax
c010a59a:	ff d0                	call   *%eax
            if (width > 0 && padc != '-') {
                for (width -= strnlen(p, precision); width > 0; width --) {
                    putch(padc, putdat);
                }
            }
            for (; (ch = *p ++) != '\0' && (precision < 0 || -- precision >= 0); width --) {
c010a59c:	83 6d e4 01          	subl   $0x1,-0x1c(%ebp)
c010a5a0:	eb 04                	jmp    c010a5a6 <vprintfmt+0x23a>
c010a5a2:	90                   	nop
c010a5a3:	eb 01                	jmp    c010a5a6 <vprintfmt+0x23a>
c010a5a5:	90                   	nop
c010a5a6:	0f b6 06             	movzbl (%esi),%eax
c010a5a9:	0f be d8             	movsbl %al,%ebx
c010a5ac:	85 db                	test   %ebx,%ebx
c010a5ae:	0f 95 c0             	setne  %al
c010a5b1:	83 c6 01             	add    $0x1,%esi
c010a5b4:	84 c0                	test   %al,%al
c010a5b6:	74 29                	je     c010a5e1 <vprintfmt+0x275>
c010a5b8:	83 7d e8 00          	cmpl   $0x0,-0x18(%ebp)
c010a5bc:	78 aa                	js     c010a568 <vprintfmt+0x1fc>
c010a5be:	83 6d e8 01          	subl   $0x1,-0x18(%ebp)
c010a5c2:	83 7d e8 00          	cmpl   $0x0,-0x18(%ebp)
c010a5c6:	79 a0                	jns    c010a568 <vprintfmt+0x1fc>
                }
                else {
                    putch(ch, putdat);
                }
            }
            for (; width > 0; width --) {
c010a5c8:	eb 17                	jmp    c010a5e1 <vprintfmt+0x275>
                putch(' ', putdat);
c010a5ca:	8b 45 0c             	mov    0xc(%ebp),%eax
c010a5cd:	89 44 24 04          	mov    %eax,0x4(%esp)
c010a5d1:	c7 04 24 20 00 00 00 	movl   $0x20,(%esp)
c010a5d8:	8b 45 08             	mov    0x8(%ebp),%eax
c010a5db:	ff d0                	call   *%eax
                }
                else {
                    putch(ch, putdat);
                }
            }
            for (; width > 0; width --) {
c010a5dd:	83 6d e4 01          	subl   $0x1,-0x1c(%ebp)
c010a5e1:	83 7d e4 00          	cmpl   $0x0,-0x1c(%ebp)
c010a5e5:	7f e3                	jg     c010a5ca <vprintfmt+0x25e>
                putch(' ', putdat);
            }
            break;
c010a5e7:	e9 70 01 00 00       	jmp    c010a75c <vprintfmt+0x3f0>

        // (signed) decimal
        case 'd':
            num = getint(&ap, lflag);
c010a5ec:	8b 45 ec             	mov    -0x14(%ebp),%eax
c010a5ef:	89 44 24 04          	mov    %eax,0x4(%esp)
c010a5f3:	8d 45 14             	lea    0x14(%ebp),%eax
c010a5f6:	89 04 24             	mov    %eax,(%esp)
c010a5f9:	e8 f1 fc ff ff       	call   c010a2ef <getint>
c010a5fe:	89 45 d8             	mov    %eax,-0x28(%ebp)
c010a601:	89 55 dc             	mov    %edx,-0x24(%ebp)
            if ((long long)num < 0) {
c010a604:	8b 45 d8             	mov    -0x28(%ebp),%eax
c010a607:	8b 55 dc             	mov    -0x24(%ebp),%edx
c010a60a:	85 d2                	test   %edx,%edx
c010a60c:	79 26                	jns    c010a634 <vprintfmt+0x2c8>
                putch('-', putdat);
c010a60e:	8b 45 0c             	mov    0xc(%ebp),%eax
c010a611:	89 44 24 04          	mov    %eax,0x4(%esp)
c010a615:	c7 04 24 2d 00 00 00 	movl   $0x2d,(%esp)
c010a61c:	8b 45 08             	mov    0x8(%ebp),%eax
c010a61f:	ff d0                	call   *%eax
                num = -(long long)num;
c010a621:	8b 45 d8             	mov    -0x28(%ebp),%eax
c010a624:	8b 55 dc             	mov    -0x24(%ebp),%edx
c010a627:	f7 d8                	neg    %eax
c010a629:	83 d2 00             	adc    $0x0,%edx
c010a62c:	f7 da                	neg    %edx
c010a62e:	89 45 d8             	mov    %eax,-0x28(%ebp)
c010a631:	89 55 dc             	mov    %edx,-0x24(%ebp)
            }
            base = 10;
c010a634:	c7 45 e0 0a 00 00 00 	movl   $0xa,-0x20(%ebp)
            goto number;
c010a63b:	e9 a9 00 00 00       	jmp    c010a6e9 <vprintfmt+0x37d>

        // unsigned decimal
        case 'u':
            num = getuint(&ap, lflag);
c010a640:	8b 45 ec             	mov    -0x14(%ebp),%eax
c010a643:	89 44 24 04          	mov    %eax,0x4(%esp)
c010a647:	8d 45 14             	lea    0x14(%ebp),%eax
c010a64a:	89 04 24             	mov    %eax,(%esp)
c010a64d:	e8 4e fc ff ff       	call   c010a2a0 <getuint>
c010a652:	89 45 d8             	mov    %eax,-0x28(%ebp)
c010a655:	89 55 dc             	mov    %edx,-0x24(%ebp)
            base = 10;
c010a658:	c7 45 e0 0a 00 00 00 	movl   $0xa,-0x20(%ebp)
            goto number;
c010a65f:	e9 85 00 00 00       	jmp    c010a6e9 <vprintfmt+0x37d>

        // (unsigned) octal
        case 'o':
            num = getuint(&ap, lflag);
c010a664:	8b 45 ec             	mov    -0x14(%ebp),%eax
c010a667:	89 44 24 04          	mov    %eax,0x4(%esp)
c010a66b:	8d 45 14             	lea    0x14(%ebp),%eax
c010a66e:	89 04 24             	mov    %eax,(%esp)
c010a671:	e8 2a fc ff ff       	call   c010a2a0 <getuint>
c010a676:	89 45 d8             	mov    %eax,-0x28(%ebp)
c010a679:	89 55 dc             	mov    %edx,-0x24(%ebp)
            base = 8;
c010a67c:	c7 45 e0 08 00 00 00 	movl   $0x8,-0x20(%ebp)
            goto number;
c010a683:	eb 64                	jmp    c010a6e9 <vprintfmt+0x37d>

        // pointer
        case 'p':
            putch('0', putdat);
c010a685:	8b 45 0c             	mov    0xc(%ebp),%eax
c010a688:	89 44 24 04          	mov    %eax,0x4(%esp)
c010a68c:	c7 04 24 30 00 00 00 	movl   $0x30,(%esp)
c010a693:	8b 45 08             	mov    0x8(%ebp),%eax
c010a696:	ff d0                	call   *%eax
            putch('x', putdat);
c010a698:	8b 45 0c             	mov    0xc(%ebp),%eax
c010a69b:	89 44 24 04          	mov    %eax,0x4(%esp)
c010a69f:	c7 04 24 78 00 00 00 	movl   $0x78,(%esp)
c010a6a6:	8b 45 08             	mov    0x8(%ebp),%eax
c010a6a9:	ff d0                	call   *%eax
            num = (unsigned long long)(uintptr_t)va_arg(ap, void *);
c010a6ab:	8b 45 14             	mov    0x14(%ebp),%eax
c010a6ae:	8d 50 04             	lea    0x4(%eax),%edx
c010a6b1:	89 55 14             	mov    %edx,0x14(%ebp)
c010a6b4:	8b 00                	mov    (%eax),%eax
c010a6b6:	ba 00 00 00 00       	mov    $0x0,%edx
c010a6bb:	89 45 d8             	mov    %eax,-0x28(%ebp)
c010a6be:	89 55 dc             	mov    %edx,-0x24(%ebp)
            base = 16;
c010a6c1:	c7 45 e0 10 00 00 00 	movl   $0x10,-0x20(%ebp)
            goto number;
c010a6c8:	eb 1f                	jmp    c010a6e9 <vprintfmt+0x37d>

        // (unsigned) hexadecimal
        case 'x':
            num = getuint(&ap, lflag);
c010a6ca:	8b 45 ec             	mov    -0x14(%ebp),%eax
c010a6cd:	89 44 24 04          	mov    %eax,0x4(%esp)
c010a6d1:	8d 45 14             	lea    0x14(%ebp),%eax
c010a6d4:	89 04 24             	mov    %eax,(%esp)
c010a6d7:	e8 c4 fb ff ff       	call   c010a2a0 <getuint>
c010a6dc:	89 45 d8             	mov    %eax,-0x28(%ebp)
c010a6df:	89 55 dc             	mov    %edx,-0x24(%ebp)
            base = 16;
c010a6e2:	c7 45 e0 10 00 00 00 	movl   $0x10,-0x20(%ebp)
        number:
            printnum(putch, putdat, num, base, width, padc);
c010a6e9:	0f be 55 f7          	movsbl -0x9(%ebp),%edx
c010a6ed:	8b 45 e0             	mov    -0x20(%ebp),%eax
c010a6f0:	89 54 24 18          	mov    %edx,0x18(%esp)
c010a6f4:	8b 55 e4             	mov    -0x1c(%ebp),%edx
c010a6f7:	89 54 24 14          	mov    %edx,0x14(%esp)
c010a6fb:	89 44 24 10          	mov    %eax,0x10(%esp)
c010a6ff:	8b 45 d8             	mov    -0x28(%ebp),%eax
c010a702:	8b 55 dc             	mov    -0x24(%ebp),%edx
c010a705:	89 44 24 08          	mov    %eax,0x8(%esp)
c010a709:	89 54 24 0c          	mov    %edx,0xc(%esp)
c010a70d:	8b 45 0c             	mov    0xc(%ebp),%eax
c010a710:	89 44 24 04          	mov    %eax,0x4(%esp)
c010a714:	8b 45 08             	mov    0x8(%ebp),%eax
c010a717:	89 04 24             	mov    %eax,(%esp)
c010a71a:	e8 7d fa ff ff       	call   c010a19c <printnum>
            break;
c010a71f:	eb 3b                	jmp    c010a75c <vprintfmt+0x3f0>

        // escaped '%' character
        case '%':
            putch(ch, putdat);
c010a721:	8b 45 0c             	mov    0xc(%ebp),%eax
c010a724:	89 44 24 04          	mov    %eax,0x4(%esp)
c010a728:	89 1c 24             	mov    %ebx,(%esp)
c010a72b:	8b 45 08             	mov    0x8(%ebp),%eax
c010a72e:	ff d0                	call   *%eax
            break;
c010a730:	eb 2a                	jmp    c010a75c <vprintfmt+0x3f0>

        // unrecognized escape sequence - just print it literally
        default:
            putch('%', putdat);
c010a732:	8b 45 0c             	mov    0xc(%ebp),%eax
c010a735:	89 44 24 04          	mov    %eax,0x4(%esp)
c010a739:	c7 04 24 25 00 00 00 	movl   $0x25,(%esp)
c010a740:	8b 45 08             	mov    0x8(%ebp),%eax
c010a743:	ff d0                	call   *%eax
            for (fmt --; fmt[-1] != '%'; fmt --)
c010a745:	83 6d 10 01          	subl   $0x1,0x10(%ebp)
c010a749:	eb 04                	jmp    c010a74f <vprintfmt+0x3e3>
c010a74b:	83 6d 10 01          	subl   $0x1,0x10(%ebp)
c010a74f:	8b 45 10             	mov    0x10(%ebp),%eax
c010a752:	83 e8 01             	sub    $0x1,%eax
c010a755:	0f b6 00             	movzbl (%eax),%eax
c010a758:	3c 25                	cmp    $0x25,%al
c010a75a:	75 ef                	jne    c010a74b <vprintfmt+0x3df>
                /* do nothing */;
            break;
        }
    }
c010a75c:	90                   	nop
    register int ch, err;
    unsigned long long num;
    int base, width, precision, lflag, altflag;

    while (1) {
        while ((ch = *(unsigned char *)fmt ++) != '%') {
c010a75d:	e9 2b fc ff ff       	jmp    c010a38d <vprintfmt+0x21>
            for (fmt --; fmt[-1] != '%'; fmt --)
                /* do nothing */;
            break;
        }
    }
}
c010a762:	83 c4 40             	add    $0x40,%esp
c010a765:	5b                   	pop    %ebx
c010a766:	5e                   	pop    %esi
c010a767:	5d                   	pop    %ebp
c010a768:	c3                   	ret    

c010a769 <sprintputch>:
 * sprintputch - 'print' a single character in a buffer
 * @ch:         the character will be printed
 * @b:          the buffer to place the character @ch
 * */
static void
sprintputch(int ch, struct sprintbuf *b) {
c010a769:	55                   	push   %ebp
c010a76a:	89 e5                	mov    %esp,%ebp
    b->cnt ++;
c010a76c:	8b 45 0c             	mov    0xc(%ebp),%eax
c010a76f:	8b 40 08             	mov    0x8(%eax),%eax
c010a772:	8d 50 01             	lea    0x1(%eax),%edx
c010a775:	8b 45 0c             	mov    0xc(%ebp),%eax
c010a778:	89 50 08             	mov    %edx,0x8(%eax)
    if (b->buf < b->ebuf) {
c010a77b:	8b 45 0c             	mov    0xc(%ebp),%eax
c010a77e:	8b 10                	mov    (%eax),%edx
c010a780:	8b 45 0c             	mov    0xc(%ebp),%eax
c010a783:	8b 40 04             	mov    0x4(%eax),%eax
c010a786:	39 c2                	cmp    %eax,%edx
c010a788:	73 12                	jae    c010a79c <sprintputch+0x33>
        *b->buf ++ = ch;
c010a78a:	8b 45 0c             	mov    0xc(%ebp),%eax
c010a78d:	8b 00                	mov    (%eax),%eax
c010a78f:	8b 55 08             	mov    0x8(%ebp),%edx
c010a792:	88 10                	mov    %dl,(%eax)
c010a794:	8d 50 01             	lea    0x1(%eax),%edx
c010a797:	8b 45 0c             	mov    0xc(%ebp),%eax
c010a79a:	89 10                	mov    %edx,(%eax)
    }
}
c010a79c:	5d                   	pop    %ebp
c010a79d:	c3                   	ret    

c010a79e <snprintf>:
 * @str:        the buffer to place the result into
 * @size:       the size of buffer, including the trailing null space
 * @fmt:        the format string to use
 * */
int
snprintf(char *str, size_t size, const char *fmt, ...) {
c010a79e:	55                   	push   %ebp
c010a79f:	89 e5                	mov    %esp,%ebp
c010a7a1:	83 ec 28             	sub    $0x28,%esp
    va_list ap;
    int cnt;
    va_start(ap, fmt);
c010a7a4:	8d 45 14             	lea    0x14(%ebp),%eax
c010a7a7:	89 45 f0             	mov    %eax,-0x10(%ebp)
    cnt = vsnprintf(str, size, fmt, ap);
c010a7aa:	8b 45 f0             	mov    -0x10(%ebp),%eax
c010a7ad:	89 44 24 0c          	mov    %eax,0xc(%esp)
c010a7b1:	8b 45 10             	mov    0x10(%ebp),%eax
c010a7b4:	89 44 24 08          	mov    %eax,0x8(%esp)
c010a7b8:	8b 45 0c             	mov    0xc(%ebp),%eax
c010a7bb:	89 44 24 04          	mov    %eax,0x4(%esp)
c010a7bf:	8b 45 08             	mov    0x8(%ebp),%eax
c010a7c2:	89 04 24             	mov    %eax,(%esp)
c010a7c5:	e8 08 00 00 00       	call   c010a7d2 <vsnprintf>
c010a7ca:	89 45 f4             	mov    %eax,-0xc(%ebp)
    va_end(ap);
    return cnt;
c010a7cd:	8b 45 f4             	mov    -0xc(%ebp),%eax
}
c010a7d0:	c9                   	leave  
c010a7d1:	c3                   	ret    

c010a7d2 <vsnprintf>:
 *
 * Call this function if you are already dealing with a va_list.
 * Or you probably want snprintf() instead.
 * */
int
vsnprintf(char *str, size_t size, const char *fmt, va_list ap) {
c010a7d2:	55                   	push   %ebp
c010a7d3:	89 e5                	mov    %esp,%ebp
c010a7d5:	83 ec 28             	sub    $0x28,%esp
    struct sprintbuf b = {str, str + size - 1, 0};
c010a7d8:	8b 45 0c             	mov    0xc(%ebp),%eax
c010a7db:	83 e8 01             	sub    $0x1,%eax
c010a7de:	03 45 08             	add    0x8(%ebp),%eax
c010a7e1:	8b 55 08             	mov    0x8(%ebp),%edx
c010a7e4:	89 55 ec             	mov    %edx,-0x14(%ebp)
c010a7e7:	89 45 f0             	mov    %eax,-0x10(%ebp)
c010a7ea:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
    if (str == NULL || b.buf > b.ebuf) {
c010a7f1:	83 7d 08 00          	cmpl   $0x0,0x8(%ebp)
c010a7f5:	74 0a                	je     c010a801 <vsnprintf+0x2f>
c010a7f7:	8b 55 ec             	mov    -0x14(%ebp),%edx
c010a7fa:	8b 45 f0             	mov    -0x10(%ebp),%eax
c010a7fd:	39 c2                	cmp    %eax,%edx
c010a7ff:	76 07                	jbe    c010a808 <vsnprintf+0x36>
        return -E_INVAL;
c010a801:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
c010a806:	eb 2b                	jmp    c010a833 <vsnprintf+0x61>
    }
    // print the string to the buffer
    vprintfmt((void*)sprintputch, &b, fmt, ap);
c010a808:	b8 69 a7 10 c0       	mov    $0xc010a769,%eax
c010a80d:	8b 55 14             	mov    0x14(%ebp),%edx
c010a810:	89 54 24 0c          	mov    %edx,0xc(%esp)
c010a814:	8b 55 10             	mov    0x10(%ebp),%edx
c010a817:	89 54 24 08          	mov    %edx,0x8(%esp)
c010a81b:	8d 55 ec             	lea    -0x14(%ebp),%edx
c010a81e:	89 54 24 04          	mov    %edx,0x4(%esp)
c010a822:	89 04 24             	mov    %eax,(%esp)
c010a825:	e8 42 fb ff ff       	call   c010a36c <vprintfmt>
    // null terminate the buffer
    *b.buf = '\0';
c010a82a:	8b 45 ec             	mov    -0x14(%ebp),%eax
c010a82d:	c6 00 00             	movb   $0x0,(%eax)
    return b.cnt;
c010a830:	8b 45 f4             	mov    -0xc(%ebp),%eax
}
c010a833:	c9                   	leave  
c010a834:	c3                   	ret    
c010a835:	00 00                	add    %al,(%eax)
	...

c010a838 <rand>:
 * rand - returns a pseudo-random integer
 *
 * The rand() function return a value in the range [0, RAND_MAX].
 * */
int
rand(void) {
c010a838:	55                   	push   %ebp
c010a839:	89 e5                	mov    %esp,%ebp
c010a83b:	57                   	push   %edi
c010a83c:	56                   	push   %esi
c010a83d:	53                   	push   %ebx
c010a83e:	83 ec 24             	sub    $0x24,%esp
    next = (next * 0x5DEECE66DLL + 0xBLL) & ((1LL << 48) - 1);
c010a841:	a1 98 7a 12 c0       	mov    0xc0127a98,%eax
c010a846:	8b 15 9c 7a 12 c0    	mov    0xc0127a9c,%edx
c010a84c:	69 ca 6d e6 ec de    	imul   $0xdeece66d,%edx,%ecx
c010a852:	6b f8 05             	imul   $0x5,%eax,%edi
c010a855:	01 f9                	add    %edi,%ecx
c010a857:	bf 6d e6 ec de       	mov    $0xdeece66d,%edi
c010a85c:	f7 e7                	mul    %edi
c010a85e:	01 d1                	add    %edx,%ecx
c010a860:	89 ca                	mov    %ecx,%edx
c010a862:	83 c0 0b             	add    $0xb,%eax
c010a865:	83 d2 00             	adc    $0x0,%edx
c010a868:	89 c3                	mov    %eax,%ebx
c010a86a:	80 e7 ff             	and    $0xff,%bh
c010a86d:	0f b7 f2             	movzwl %dx,%esi
c010a870:	89 1d 98 7a 12 c0    	mov    %ebx,0xc0127a98
c010a876:	89 35 9c 7a 12 c0    	mov    %esi,0xc0127a9c
    unsigned long long result = (next >> 12);
c010a87c:	a1 98 7a 12 c0       	mov    0xc0127a98,%eax
c010a881:	8b 15 9c 7a 12 c0    	mov    0xc0127a9c,%edx
c010a887:	0f ac d0 0c          	shrd   $0xc,%edx,%eax
c010a88b:	c1 ea 0c             	shr    $0xc,%edx
c010a88e:	89 45 d0             	mov    %eax,-0x30(%ebp)
c010a891:	89 55 d4             	mov    %edx,-0x2c(%ebp)
    return (int)do_div(result, RAND_MAX + 1);
c010a894:	c7 45 ec 00 00 00 80 	movl   $0x80000000,-0x14(%ebp)
c010a89b:	8b 45 d0             	mov    -0x30(%ebp),%eax
c010a89e:	8b 55 d4             	mov    -0x2c(%ebp),%edx
c010a8a1:	89 45 e0             	mov    %eax,-0x20(%ebp)
c010a8a4:	89 55 e4             	mov    %edx,-0x1c(%ebp)
c010a8a7:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c010a8aa:	89 45 dc             	mov    %eax,-0x24(%ebp)
c010a8ad:	83 7d e4 00          	cmpl   $0x0,-0x1c(%ebp)
c010a8b1:	74 1c                	je     c010a8cf <rand+0x97>
c010a8b3:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c010a8b6:	ba 00 00 00 00       	mov    $0x0,%edx
c010a8bb:	f7 75 ec             	divl   -0x14(%ebp)
c010a8be:	89 55 dc             	mov    %edx,-0x24(%ebp)
c010a8c1:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c010a8c4:	ba 00 00 00 00       	mov    $0x0,%edx
c010a8c9:	f7 75 ec             	divl   -0x14(%ebp)
c010a8cc:	89 45 e4             	mov    %eax,-0x1c(%ebp)
c010a8cf:	8b 45 e0             	mov    -0x20(%ebp),%eax
c010a8d2:	8b 55 dc             	mov    -0x24(%ebp),%edx
c010a8d5:	f7 75 ec             	divl   -0x14(%ebp)
c010a8d8:	89 45 e0             	mov    %eax,-0x20(%ebp)
c010a8db:	89 55 e8             	mov    %edx,-0x18(%ebp)
c010a8de:	8b 45 e0             	mov    -0x20(%ebp),%eax
c010a8e1:	8b 55 e4             	mov    -0x1c(%ebp),%edx
c010a8e4:	89 45 d0             	mov    %eax,-0x30(%ebp)
c010a8e7:	89 55 d4             	mov    %edx,-0x2c(%ebp)
c010a8ea:	8b 45 e8             	mov    -0x18(%ebp),%eax
}
c010a8ed:	83 c4 24             	add    $0x24,%esp
c010a8f0:	5b                   	pop    %ebx
c010a8f1:	5e                   	pop    %esi
c010a8f2:	5f                   	pop    %edi
c010a8f3:	5d                   	pop    %ebp
c010a8f4:	c3                   	ret    

c010a8f5 <srand>:
/* *
 * srand - seed the random number generator with the given number
 * @seed:   the required seed number
 * */
void
srand(unsigned int seed) {
c010a8f5:	55                   	push   %ebp
c010a8f6:	89 e5                	mov    %esp,%ebp
    next = seed;
c010a8f8:	8b 45 08             	mov    0x8(%ebp),%eax
c010a8fb:	ba 00 00 00 00       	mov    $0x0,%edx
c010a900:	a3 98 7a 12 c0       	mov    %eax,0xc0127a98
c010a905:	89 15 9c 7a 12 c0    	mov    %edx,0xc0127a9c
}
c010a90b:	5d                   	pop    %ebp
c010a90c:	c3                   	ret    
c010a90d:	00 00                	add    %al,(%eax)
	...

c010a910 <strlen>:
 * @s:      the input string
 *
 * The strlen() function returns the length of string @s.
 * */
size_t
strlen(const char *s) {
c010a910:	55                   	push   %ebp
c010a911:	89 e5                	mov    %esp,%ebp
c010a913:	83 ec 10             	sub    $0x10,%esp
    size_t cnt = 0;
c010a916:	c7 45 fc 00 00 00 00 	movl   $0x0,-0x4(%ebp)
    while (*s ++ != '\0') {
c010a91d:	eb 04                	jmp    c010a923 <strlen+0x13>
        cnt ++;
c010a91f:	83 45 fc 01          	addl   $0x1,-0x4(%ebp)
 * The strlen() function returns the length of string @s.
 * */
size_t
strlen(const char *s) {
    size_t cnt = 0;
    while (*s ++ != '\0') {
c010a923:	8b 45 08             	mov    0x8(%ebp),%eax
c010a926:	0f b6 00             	movzbl (%eax),%eax
c010a929:	84 c0                	test   %al,%al
c010a92b:	0f 95 c0             	setne  %al
c010a92e:	83 45 08 01          	addl   $0x1,0x8(%ebp)
c010a932:	84 c0                	test   %al,%al
c010a934:	75 e9                	jne    c010a91f <strlen+0xf>
        cnt ++;
    }
    return cnt;
c010a936:	8b 45 fc             	mov    -0x4(%ebp),%eax
}
c010a939:	c9                   	leave  
c010a93a:	c3                   	ret    

c010a93b <strnlen>:
 * The return value is strlen(s), if that is less than @len, or
 * @len if there is no '\0' character among the first @len characters
 * pointed by @s.
 * */
size_t
strnlen(const char *s, size_t len) {
c010a93b:	55                   	push   %ebp
c010a93c:	89 e5                	mov    %esp,%ebp
c010a93e:	83 ec 10             	sub    $0x10,%esp
    size_t cnt = 0;
c010a941:	c7 45 fc 00 00 00 00 	movl   $0x0,-0x4(%ebp)
    while (cnt < len && *s ++ != '\0') {
c010a948:	eb 04                	jmp    c010a94e <strnlen+0x13>
        cnt ++;
c010a94a:	83 45 fc 01          	addl   $0x1,-0x4(%ebp)
 * pointed by @s.
 * */
size_t
strnlen(const char *s, size_t len) {
    size_t cnt = 0;
    while (cnt < len && *s ++ != '\0') {
c010a94e:	8b 45 fc             	mov    -0x4(%ebp),%eax
c010a951:	3b 45 0c             	cmp    0xc(%ebp),%eax
c010a954:	73 13                	jae    c010a969 <strnlen+0x2e>
c010a956:	8b 45 08             	mov    0x8(%ebp),%eax
c010a959:	0f b6 00             	movzbl (%eax),%eax
c010a95c:	84 c0                	test   %al,%al
c010a95e:	0f 95 c0             	setne  %al
c010a961:	83 45 08 01          	addl   $0x1,0x8(%ebp)
c010a965:	84 c0                	test   %al,%al
c010a967:	75 e1                	jne    c010a94a <strnlen+0xf>
        cnt ++;
    }
    return cnt;
c010a969:	8b 45 fc             	mov    -0x4(%ebp),%eax
}
c010a96c:	c9                   	leave  
c010a96d:	c3                   	ret    

c010a96e <strcpy>:
 * To avoid overflows, the size of array pointed by @dst should be long enough to
 * contain the same string as @src (including the terminating null character), and
 * should not overlap in memory with @src.
 * */
char *
strcpy(char *dst, const char *src) {
c010a96e:	55                   	push   %ebp
c010a96f:	89 e5                	mov    %esp,%ebp
c010a971:	57                   	push   %edi
c010a972:	56                   	push   %esi
c010a973:	83 ec 20             	sub    $0x20,%esp
c010a976:	8b 45 08             	mov    0x8(%ebp),%eax
c010a979:	89 45 e8             	mov    %eax,-0x18(%ebp)
c010a97c:	8b 45 0c             	mov    0xc(%ebp),%eax
c010a97f:	89 45 e4             	mov    %eax,-0x1c(%ebp)
#ifndef __HAVE_ARCH_STRCPY
#define __HAVE_ARCH_STRCPY
static inline char *
__strcpy(char *dst, const char *src) {
    int d0, d1, d2;
    asm volatile (
c010a982:	8b 55 e4             	mov    -0x1c(%ebp),%edx
c010a985:	8b 45 e8             	mov    -0x18(%ebp),%eax
c010a988:	89 d1                	mov    %edx,%ecx
c010a98a:	89 c2                	mov    %eax,%edx
c010a98c:	89 ce                	mov    %ecx,%esi
c010a98e:	89 d7                	mov    %edx,%edi
c010a990:	ac                   	lods   %ds:(%esi),%al
c010a991:	aa                   	stos   %al,%es:(%edi)
c010a992:	84 c0                	test   %al,%al
c010a994:	75 fa                	jne    c010a990 <strcpy+0x22>
c010a996:	89 fa                	mov    %edi,%edx
c010a998:	89 f1                	mov    %esi,%ecx
c010a99a:	89 4d f4             	mov    %ecx,-0xc(%ebp)
c010a99d:	89 55 f0             	mov    %edx,-0x10(%ebp)
c010a9a0:	89 45 ec             	mov    %eax,-0x14(%ebp)
        "stosb;"
        "testb %%al, %%al;"
        "jne 1b;"
        : "=&S" (d0), "=&D" (d1), "=&a" (d2)
        : "0" (src), "1" (dst) : "memory");
    return dst;
c010a9a3:	8b 45 e8             	mov    -0x18(%ebp),%eax
    char *p = dst;
    while ((*p ++ = *src ++) != '\0')
        /* nothing */;
    return dst;
#endif /* __HAVE_ARCH_STRCPY */
}
c010a9a6:	83 c4 20             	add    $0x20,%esp
c010a9a9:	5e                   	pop    %esi
c010a9aa:	5f                   	pop    %edi
c010a9ab:	5d                   	pop    %ebp
c010a9ac:	c3                   	ret    

c010a9ad <strncpy>:
 * @len:    maximum number of characters to be copied from @src
 *
 * The return value is @dst
 * */
char *
strncpy(char *dst, const char *src, size_t len) {
c010a9ad:	55                   	push   %ebp
c010a9ae:	89 e5                	mov    %esp,%ebp
c010a9b0:	83 ec 10             	sub    $0x10,%esp
    char *p = dst;
c010a9b3:	8b 45 08             	mov    0x8(%ebp),%eax
c010a9b6:	89 45 fc             	mov    %eax,-0x4(%ebp)
    while (len > 0) {
c010a9b9:	eb 21                	jmp    c010a9dc <strncpy+0x2f>
        if ((*p = *src) != '\0') {
c010a9bb:	8b 45 0c             	mov    0xc(%ebp),%eax
c010a9be:	0f b6 10             	movzbl (%eax),%edx
c010a9c1:	8b 45 fc             	mov    -0x4(%ebp),%eax
c010a9c4:	88 10                	mov    %dl,(%eax)
c010a9c6:	8b 45 fc             	mov    -0x4(%ebp),%eax
c010a9c9:	0f b6 00             	movzbl (%eax),%eax
c010a9cc:	84 c0                	test   %al,%al
c010a9ce:	74 04                	je     c010a9d4 <strncpy+0x27>
            src ++;
c010a9d0:	83 45 0c 01          	addl   $0x1,0xc(%ebp)
        }
        p ++, len --;
c010a9d4:	83 45 fc 01          	addl   $0x1,-0x4(%ebp)
c010a9d8:	83 6d 10 01          	subl   $0x1,0x10(%ebp)
 * The return value is @dst
 * */
char *
strncpy(char *dst, const char *src, size_t len) {
    char *p = dst;
    while (len > 0) {
c010a9dc:	83 7d 10 00          	cmpl   $0x0,0x10(%ebp)
c010a9e0:	75 d9                	jne    c010a9bb <strncpy+0xe>
        if ((*p = *src) != '\0') {
            src ++;
        }
        p ++, len --;
    }
    return dst;
c010a9e2:	8b 45 08             	mov    0x8(%ebp),%eax
}
c010a9e5:	c9                   	leave  
c010a9e6:	c3                   	ret    

c010a9e7 <strcmp>:
 * - A value greater than zero indicates that the first character that does
 *   not match has a greater value in @s1 than in @s2;
 * - And a value less than zero indicates the opposite.
 * */
int
strcmp(const char *s1, const char *s2) {
c010a9e7:	55                   	push   %ebp
c010a9e8:	89 e5                	mov    %esp,%ebp
c010a9ea:	57                   	push   %edi
c010a9eb:	56                   	push   %esi
c010a9ec:	83 ec 20             	sub    $0x20,%esp
c010a9ef:	8b 45 08             	mov    0x8(%ebp),%eax
c010a9f2:	89 45 e8             	mov    %eax,-0x18(%ebp)
c010a9f5:	8b 45 0c             	mov    0xc(%ebp),%eax
c010a9f8:	89 45 e4             	mov    %eax,-0x1c(%ebp)
#ifndef __HAVE_ARCH_STRCMP
#define __HAVE_ARCH_STRCMP
static inline int
__strcmp(const char *s1, const char *s2) {
    int d0, d1, ret;
    asm volatile (
c010a9fb:	8b 55 e8             	mov    -0x18(%ebp),%edx
c010a9fe:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c010aa01:	89 d1                	mov    %edx,%ecx
c010aa03:	89 c2                	mov    %eax,%edx
c010aa05:	89 ce                	mov    %ecx,%esi
c010aa07:	89 d7                	mov    %edx,%edi
c010aa09:	ac                   	lods   %ds:(%esi),%al
c010aa0a:	ae                   	scas   %es:(%edi),%al
c010aa0b:	75 08                	jne    c010aa15 <strcmp+0x2e>
c010aa0d:	84 c0                	test   %al,%al
c010aa0f:	75 f8                	jne    c010aa09 <strcmp+0x22>
c010aa11:	31 c0                	xor    %eax,%eax
c010aa13:	eb 04                	jmp    c010aa19 <strcmp+0x32>
c010aa15:	19 c0                	sbb    %eax,%eax
c010aa17:	0c 01                	or     $0x1,%al
c010aa19:	89 fa                	mov    %edi,%edx
c010aa1b:	89 f1                	mov    %esi,%ecx
c010aa1d:	89 45 ec             	mov    %eax,-0x14(%ebp)
c010aa20:	89 4d f4             	mov    %ecx,-0xc(%ebp)
c010aa23:	89 55 f0             	mov    %edx,-0x10(%ebp)
        "orb $1, %%al;"
        "3:"
        : "=a" (ret), "=&S" (d0), "=&D" (d1)
        : "1" (s1), "2" (s2)
        : "memory");
    return ret;
c010aa26:	8b 45 ec             	mov    -0x14(%ebp),%eax
    while (*s1 != '\0' && *s1 == *s2) {
        s1 ++, s2 ++;
    }
    return (int)((unsigned char)*s1 - (unsigned char)*s2);
#endif /* __HAVE_ARCH_STRCMP */
}
c010aa29:	83 c4 20             	add    $0x20,%esp
c010aa2c:	5e                   	pop    %esi
c010aa2d:	5f                   	pop    %edi
c010aa2e:	5d                   	pop    %ebp
c010aa2f:	c3                   	ret    

c010aa30 <strncmp>:
 * they are equal to each other, it continues with the following pairs until
 * the characters differ, until a terminating null-character is reached, or
 * until @n characters match in both strings, whichever happens first.
 * */
int
strncmp(const char *s1, const char *s2, size_t n) {
c010aa30:	55                   	push   %ebp
c010aa31:	89 e5                	mov    %esp,%ebp
    while (n > 0 && *s1 != '\0' && *s1 == *s2) {
c010aa33:	eb 0c                	jmp    c010aa41 <strncmp+0x11>
        n --, s1 ++, s2 ++;
c010aa35:	83 6d 10 01          	subl   $0x1,0x10(%ebp)
c010aa39:	83 45 08 01          	addl   $0x1,0x8(%ebp)
c010aa3d:	83 45 0c 01          	addl   $0x1,0xc(%ebp)
 * the characters differ, until a terminating null-character is reached, or
 * until @n characters match in both strings, whichever happens first.
 * */
int
strncmp(const char *s1, const char *s2, size_t n) {
    while (n > 0 && *s1 != '\0' && *s1 == *s2) {
c010aa41:	83 7d 10 00          	cmpl   $0x0,0x10(%ebp)
c010aa45:	74 1a                	je     c010aa61 <strncmp+0x31>
c010aa47:	8b 45 08             	mov    0x8(%ebp),%eax
c010aa4a:	0f b6 00             	movzbl (%eax),%eax
c010aa4d:	84 c0                	test   %al,%al
c010aa4f:	74 10                	je     c010aa61 <strncmp+0x31>
c010aa51:	8b 45 08             	mov    0x8(%ebp),%eax
c010aa54:	0f b6 10             	movzbl (%eax),%edx
c010aa57:	8b 45 0c             	mov    0xc(%ebp),%eax
c010aa5a:	0f b6 00             	movzbl (%eax),%eax
c010aa5d:	38 c2                	cmp    %al,%dl
c010aa5f:	74 d4                	je     c010aa35 <strncmp+0x5>
        n --, s1 ++, s2 ++;
    }
    return (n == 0) ? 0 : (int)((unsigned char)*s1 - (unsigned char)*s2);
c010aa61:	83 7d 10 00          	cmpl   $0x0,0x10(%ebp)
c010aa65:	74 1a                	je     c010aa81 <strncmp+0x51>
c010aa67:	8b 45 08             	mov    0x8(%ebp),%eax
c010aa6a:	0f b6 00             	movzbl (%eax),%eax
c010aa6d:	0f b6 d0             	movzbl %al,%edx
c010aa70:	8b 45 0c             	mov    0xc(%ebp),%eax
c010aa73:	0f b6 00             	movzbl (%eax),%eax
c010aa76:	0f b6 c0             	movzbl %al,%eax
c010aa79:	89 d1                	mov    %edx,%ecx
c010aa7b:	29 c1                	sub    %eax,%ecx
c010aa7d:	89 c8                	mov    %ecx,%eax
c010aa7f:	eb 05                	jmp    c010aa86 <strncmp+0x56>
c010aa81:	b8 00 00 00 00       	mov    $0x0,%eax
}
c010aa86:	5d                   	pop    %ebp
c010aa87:	c3                   	ret    

c010aa88 <strchr>:
 *
 * The strchr() function returns a pointer to the first occurrence of
 * character in @s. If the value is not found, the function returns 'NULL'.
 * */
char *
strchr(const char *s, char c) {
c010aa88:	55                   	push   %ebp
c010aa89:	89 e5                	mov    %esp,%ebp
c010aa8b:	83 ec 04             	sub    $0x4,%esp
c010aa8e:	8b 45 0c             	mov    0xc(%ebp),%eax
c010aa91:	88 45 fc             	mov    %al,-0x4(%ebp)
    while (*s != '\0') {
c010aa94:	eb 14                	jmp    c010aaaa <strchr+0x22>
        if (*s == c) {
c010aa96:	8b 45 08             	mov    0x8(%ebp),%eax
c010aa99:	0f b6 00             	movzbl (%eax),%eax
c010aa9c:	3a 45 fc             	cmp    -0x4(%ebp),%al
c010aa9f:	75 05                	jne    c010aaa6 <strchr+0x1e>
            return (char *)s;
c010aaa1:	8b 45 08             	mov    0x8(%ebp),%eax
c010aaa4:	eb 13                	jmp    c010aab9 <strchr+0x31>
        }
        s ++;
c010aaa6:	83 45 08 01          	addl   $0x1,0x8(%ebp)
 * The strchr() function returns a pointer to the first occurrence of
 * character in @s. If the value is not found, the function returns 'NULL'.
 * */
char *
strchr(const char *s, char c) {
    while (*s != '\0') {
c010aaaa:	8b 45 08             	mov    0x8(%ebp),%eax
c010aaad:	0f b6 00             	movzbl (%eax),%eax
c010aab0:	84 c0                	test   %al,%al
c010aab2:	75 e2                	jne    c010aa96 <strchr+0xe>
        if (*s == c) {
            return (char *)s;
        }
        s ++;
    }
    return NULL;
c010aab4:	b8 00 00 00 00       	mov    $0x0,%eax
}
c010aab9:	c9                   	leave  
c010aaba:	c3                   	ret    

c010aabb <strfind>:
 * The strfind() function is like strchr() except that if @c is
 * not found in @s, then it returns a pointer to the null byte at the
 * end of @s, rather than 'NULL'.
 * */
char *
strfind(const char *s, char c) {
c010aabb:	55                   	push   %ebp
c010aabc:	89 e5                	mov    %esp,%ebp
c010aabe:	83 ec 04             	sub    $0x4,%esp
c010aac1:	8b 45 0c             	mov    0xc(%ebp),%eax
c010aac4:	88 45 fc             	mov    %al,-0x4(%ebp)
    while (*s != '\0') {
c010aac7:	eb 0f                	jmp    c010aad8 <strfind+0x1d>
        if (*s == c) {
c010aac9:	8b 45 08             	mov    0x8(%ebp),%eax
c010aacc:	0f b6 00             	movzbl (%eax),%eax
c010aacf:	3a 45 fc             	cmp    -0x4(%ebp),%al
c010aad2:	74 10                	je     c010aae4 <strfind+0x29>
            break;
        }
        s ++;
c010aad4:	83 45 08 01          	addl   $0x1,0x8(%ebp)
 * not found in @s, then it returns a pointer to the null byte at the
 * end of @s, rather than 'NULL'.
 * */
char *
strfind(const char *s, char c) {
    while (*s != '\0') {
c010aad8:	8b 45 08             	mov    0x8(%ebp),%eax
c010aadb:	0f b6 00             	movzbl (%eax),%eax
c010aade:	84 c0                	test   %al,%al
c010aae0:	75 e7                	jne    c010aac9 <strfind+0xe>
c010aae2:	eb 01                	jmp    c010aae5 <strfind+0x2a>
        if (*s == c) {
            break;
c010aae4:	90                   	nop
        }
        s ++;
    }
    return (char *)s;
c010aae5:	8b 45 08             	mov    0x8(%ebp),%eax
}
c010aae8:	c9                   	leave  
c010aae9:	c3                   	ret    

c010aaea <strtol>:
 * an optional "0x" or "0X" prefix.
 *
 * The strtol() function returns the converted integral number as a long int value.
 * */
long
strtol(const char *s, char **endptr, int base) {
c010aaea:	55                   	push   %ebp
c010aaeb:	89 e5                	mov    %esp,%ebp
c010aaed:	83 ec 10             	sub    $0x10,%esp
    int neg = 0;
c010aaf0:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
    long val = 0;
c010aaf7:	c7 45 f8 00 00 00 00 	movl   $0x0,-0x8(%ebp)

    // gobble initial whitespace
    while (*s == ' ' || *s == '\t') {
c010aafe:	eb 04                	jmp    c010ab04 <strtol+0x1a>
        s ++;
c010ab00:	83 45 08 01          	addl   $0x1,0x8(%ebp)
strtol(const char *s, char **endptr, int base) {
    int neg = 0;
    long val = 0;

    // gobble initial whitespace
    while (*s == ' ' || *s == '\t') {
c010ab04:	8b 45 08             	mov    0x8(%ebp),%eax
c010ab07:	0f b6 00             	movzbl (%eax),%eax
c010ab0a:	3c 20                	cmp    $0x20,%al
c010ab0c:	74 f2                	je     c010ab00 <strtol+0x16>
c010ab0e:	8b 45 08             	mov    0x8(%ebp),%eax
c010ab11:	0f b6 00             	movzbl (%eax),%eax
c010ab14:	3c 09                	cmp    $0x9,%al
c010ab16:	74 e8                	je     c010ab00 <strtol+0x16>
        s ++;
    }

    // plus/minus sign
    if (*s == '+') {
c010ab18:	8b 45 08             	mov    0x8(%ebp),%eax
c010ab1b:	0f b6 00             	movzbl (%eax),%eax
c010ab1e:	3c 2b                	cmp    $0x2b,%al
c010ab20:	75 06                	jne    c010ab28 <strtol+0x3e>
        s ++;
c010ab22:	83 45 08 01          	addl   $0x1,0x8(%ebp)
c010ab26:	eb 15                	jmp    c010ab3d <strtol+0x53>
    }
    else if (*s == '-') {
c010ab28:	8b 45 08             	mov    0x8(%ebp),%eax
c010ab2b:	0f b6 00             	movzbl (%eax),%eax
c010ab2e:	3c 2d                	cmp    $0x2d,%al
c010ab30:	75 0b                	jne    c010ab3d <strtol+0x53>
        s ++, neg = 1;
c010ab32:	83 45 08 01          	addl   $0x1,0x8(%ebp)
c010ab36:	c7 45 f4 01 00 00 00 	movl   $0x1,-0xc(%ebp)
    }

    // hex or octal base prefix
    if ((base == 0 || base == 16) && (s[0] == '0' && s[1] == 'x')) {
c010ab3d:	83 7d 10 00          	cmpl   $0x0,0x10(%ebp)
c010ab41:	74 06                	je     c010ab49 <strtol+0x5f>
c010ab43:	83 7d 10 10          	cmpl   $0x10,0x10(%ebp)
c010ab47:	75 24                	jne    c010ab6d <strtol+0x83>
c010ab49:	8b 45 08             	mov    0x8(%ebp),%eax
c010ab4c:	0f b6 00             	movzbl (%eax),%eax
c010ab4f:	3c 30                	cmp    $0x30,%al
c010ab51:	75 1a                	jne    c010ab6d <strtol+0x83>
c010ab53:	8b 45 08             	mov    0x8(%ebp),%eax
c010ab56:	83 c0 01             	add    $0x1,%eax
c010ab59:	0f b6 00             	movzbl (%eax),%eax
c010ab5c:	3c 78                	cmp    $0x78,%al
c010ab5e:	75 0d                	jne    c010ab6d <strtol+0x83>
        s += 2, base = 16;
c010ab60:	83 45 08 02          	addl   $0x2,0x8(%ebp)
c010ab64:	c7 45 10 10 00 00 00 	movl   $0x10,0x10(%ebp)
    else if (*s == '-') {
        s ++, neg = 1;
    }

    // hex or octal base prefix
    if ((base == 0 || base == 16) && (s[0] == '0' && s[1] == 'x')) {
c010ab6b:	eb 2a                	jmp    c010ab97 <strtol+0xad>
        s += 2, base = 16;
    }
    else if (base == 0 && s[0] == '0') {
c010ab6d:	83 7d 10 00          	cmpl   $0x0,0x10(%ebp)
c010ab71:	75 17                	jne    c010ab8a <strtol+0xa0>
c010ab73:	8b 45 08             	mov    0x8(%ebp),%eax
c010ab76:	0f b6 00             	movzbl (%eax),%eax
c010ab79:	3c 30                	cmp    $0x30,%al
c010ab7b:	75 0d                	jne    c010ab8a <strtol+0xa0>
        s ++, base = 8;
c010ab7d:	83 45 08 01          	addl   $0x1,0x8(%ebp)
c010ab81:	c7 45 10 08 00 00 00 	movl   $0x8,0x10(%ebp)

    // hex or octal base prefix
    if ((base == 0 || base == 16) && (s[0] == '0' && s[1] == 'x')) {
        s += 2, base = 16;
    }
    else if (base == 0 && s[0] == '0') {
c010ab88:	eb 0d                	jmp    c010ab97 <strtol+0xad>
        s ++, base = 8;
    }
    else if (base == 0) {
c010ab8a:	83 7d 10 00          	cmpl   $0x0,0x10(%ebp)
c010ab8e:	75 07                	jne    c010ab97 <strtol+0xad>
        base = 10;
c010ab90:	c7 45 10 0a 00 00 00 	movl   $0xa,0x10(%ebp)

    // digits
    while (1) {
        int dig;

        if (*s >= '0' && *s <= '9') {
c010ab97:	8b 45 08             	mov    0x8(%ebp),%eax
c010ab9a:	0f b6 00             	movzbl (%eax),%eax
c010ab9d:	3c 2f                	cmp    $0x2f,%al
c010ab9f:	7e 1b                	jle    c010abbc <strtol+0xd2>
c010aba1:	8b 45 08             	mov    0x8(%ebp),%eax
c010aba4:	0f b6 00             	movzbl (%eax),%eax
c010aba7:	3c 39                	cmp    $0x39,%al
c010aba9:	7f 11                	jg     c010abbc <strtol+0xd2>
            dig = *s - '0';
c010abab:	8b 45 08             	mov    0x8(%ebp),%eax
c010abae:	0f b6 00             	movzbl (%eax),%eax
c010abb1:	0f be c0             	movsbl %al,%eax
c010abb4:	83 e8 30             	sub    $0x30,%eax
c010abb7:	89 45 fc             	mov    %eax,-0x4(%ebp)

    // digits
    while (1) {
        int dig;

        if (*s >= '0' && *s <= '9') {
c010abba:	eb 48                	jmp    c010ac04 <strtol+0x11a>
            dig = *s - '0';
        }
        else if (*s >= 'a' && *s <= 'z') {
c010abbc:	8b 45 08             	mov    0x8(%ebp),%eax
c010abbf:	0f b6 00             	movzbl (%eax),%eax
c010abc2:	3c 60                	cmp    $0x60,%al
c010abc4:	7e 1b                	jle    c010abe1 <strtol+0xf7>
c010abc6:	8b 45 08             	mov    0x8(%ebp),%eax
c010abc9:	0f b6 00             	movzbl (%eax),%eax
c010abcc:	3c 7a                	cmp    $0x7a,%al
c010abce:	7f 11                	jg     c010abe1 <strtol+0xf7>
            dig = *s - 'a' + 10;
c010abd0:	8b 45 08             	mov    0x8(%ebp),%eax
c010abd3:	0f b6 00             	movzbl (%eax),%eax
c010abd6:	0f be c0             	movsbl %al,%eax
c010abd9:	83 e8 57             	sub    $0x57,%eax
c010abdc:	89 45 fc             	mov    %eax,-0x4(%ebp)
        int dig;

        if (*s >= '0' && *s <= '9') {
            dig = *s - '0';
        }
        else if (*s >= 'a' && *s <= 'z') {
c010abdf:	eb 23                	jmp    c010ac04 <strtol+0x11a>
            dig = *s - 'a' + 10;
        }
        else if (*s >= 'A' && *s <= 'Z') {
c010abe1:	8b 45 08             	mov    0x8(%ebp),%eax
c010abe4:	0f b6 00             	movzbl (%eax),%eax
c010abe7:	3c 40                	cmp    $0x40,%al
c010abe9:	7e 38                	jle    c010ac23 <strtol+0x139>
c010abeb:	8b 45 08             	mov    0x8(%ebp),%eax
c010abee:	0f b6 00             	movzbl (%eax),%eax
c010abf1:	3c 5a                	cmp    $0x5a,%al
c010abf3:	7f 2e                	jg     c010ac23 <strtol+0x139>
            dig = *s - 'A' + 10;
c010abf5:	8b 45 08             	mov    0x8(%ebp),%eax
c010abf8:	0f b6 00             	movzbl (%eax),%eax
c010abfb:	0f be c0             	movsbl %al,%eax
c010abfe:	83 e8 37             	sub    $0x37,%eax
c010ac01:	89 45 fc             	mov    %eax,-0x4(%ebp)
        }
        else {
            break;
        }
        if (dig >= base) {
c010ac04:	8b 45 fc             	mov    -0x4(%ebp),%eax
c010ac07:	3b 45 10             	cmp    0x10(%ebp),%eax
c010ac0a:	7d 16                	jge    c010ac22 <strtol+0x138>
            break;
        }
        s ++, val = (val * base) + dig;
c010ac0c:	83 45 08 01          	addl   $0x1,0x8(%ebp)
c010ac10:	8b 45 f8             	mov    -0x8(%ebp),%eax
c010ac13:	0f af 45 10          	imul   0x10(%ebp),%eax
c010ac17:	03 45 fc             	add    -0x4(%ebp),%eax
c010ac1a:	89 45 f8             	mov    %eax,-0x8(%ebp)
        // we don't properly detect overflow!
    }
c010ac1d:	e9 75 ff ff ff       	jmp    c010ab97 <strtol+0xad>
        }
        else {
            break;
        }
        if (dig >= base) {
            break;
c010ac22:	90                   	nop
        }
        s ++, val = (val * base) + dig;
        // we don't properly detect overflow!
    }

    if (endptr) {
c010ac23:	83 7d 0c 00          	cmpl   $0x0,0xc(%ebp)
c010ac27:	74 08                	je     c010ac31 <strtol+0x147>
        *endptr = (char *) s;
c010ac29:	8b 45 0c             	mov    0xc(%ebp),%eax
c010ac2c:	8b 55 08             	mov    0x8(%ebp),%edx
c010ac2f:	89 10                	mov    %edx,(%eax)
    }
    return (neg ? -val : val);
c010ac31:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c010ac35:	74 07                	je     c010ac3e <strtol+0x154>
c010ac37:	8b 45 f8             	mov    -0x8(%ebp),%eax
c010ac3a:	f7 d8                	neg    %eax
c010ac3c:	eb 03                	jmp    c010ac41 <strtol+0x157>
c010ac3e:	8b 45 f8             	mov    -0x8(%ebp),%eax
}
c010ac41:	c9                   	leave  
c010ac42:	c3                   	ret    

c010ac43 <memset>:
 * @n:      number of bytes to be set to the value
 *
 * The memset() function returns @s.
 * */
void *
memset(void *s, char c, size_t n) {
c010ac43:	55                   	push   %ebp
c010ac44:	89 e5                	mov    %esp,%ebp
c010ac46:	57                   	push   %edi
c010ac47:	83 ec 24             	sub    $0x24,%esp
c010ac4a:	8b 45 0c             	mov    0xc(%ebp),%eax
c010ac4d:	88 45 d8             	mov    %al,-0x28(%ebp)
#ifdef __HAVE_ARCH_MEMSET
    return __memset(s, c, n);
c010ac50:	0f be 45 d8          	movsbl -0x28(%ebp),%eax
c010ac54:	8b 55 08             	mov    0x8(%ebp),%edx
c010ac57:	89 55 f0             	mov    %edx,-0x10(%ebp)
c010ac5a:	88 45 ef             	mov    %al,-0x11(%ebp)
c010ac5d:	8b 45 10             	mov    0x10(%ebp),%eax
c010ac60:	89 45 e8             	mov    %eax,-0x18(%ebp)
#ifndef __HAVE_ARCH_MEMSET
#define __HAVE_ARCH_MEMSET
static inline void *
__memset(void *s, char c, size_t n) {
    int d0, d1;
    asm volatile (
c010ac63:	8b 4d e8             	mov    -0x18(%ebp),%ecx
c010ac66:	0f b6 45 ef          	movzbl -0x11(%ebp),%eax
c010ac6a:	8b 55 f0             	mov    -0x10(%ebp),%edx
c010ac6d:	89 d7                	mov    %edx,%edi
c010ac6f:	f3 aa                	rep stos %al,%es:(%edi)
c010ac71:	89 fa                	mov    %edi,%edx
c010ac73:	89 4d f8             	mov    %ecx,-0x8(%ebp)
c010ac76:	89 55 f4             	mov    %edx,-0xc(%ebp)
        "rep; stosb;"
        : "=&c" (d0), "=&D" (d1)
        : "0" (n), "a" (c), "1" (s)
        : "memory");
    return s;
c010ac79:	8b 45 f0             	mov    -0x10(%ebp),%eax
    while (n -- > 0) {
        *p ++ = c;
    }
    return s;
#endif /* __HAVE_ARCH_MEMSET */
}
c010ac7c:	83 c4 24             	add    $0x24,%esp
c010ac7f:	5f                   	pop    %edi
c010ac80:	5d                   	pop    %ebp
c010ac81:	c3                   	ret    

c010ac82 <memmove>:
 * @n:      number of bytes to copy
 *
 * The memmove() function returns @dst.
 * */
void *
memmove(void *dst, const void *src, size_t n) {
c010ac82:	55                   	push   %ebp
c010ac83:	89 e5                	mov    %esp,%ebp
c010ac85:	57                   	push   %edi
c010ac86:	56                   	push   %esi
c010ac87:	83 ec 30             	sub    $0x30,%esp
c010ac8a:	8b 45 08             	mov    0x8(%ebp),%eax
c010ac8d:	89 45 d0             	mov    %eax,-0x30(%ebp)
c010ac90:	8b 45 0c             	mov    0xc(%ebp),%eax
c010ac93:	89 45 cc             	mov    %eax,-0x34(%ebp)
c010ac96:	8b 45 10             	mov    0x10(%ebp),%eax
c010ac99:	89 45 c8             	mov    %eax,-0x38(%ebp)

#ifndef __HAVE_ARCH_MEMMOVE
#define __HAVE_ARCH_MEMMOVE
static inline void *
__memmove(void *dst, const void *src, size_t n) {
    if (dst < src) {
c010ac9c:	8b 45 d0             	mov    -0x30(%ebp),%eax
c010ac9f:	3b 45 cc             	cmp    -0x34(%ebp),%eax
c010aca2:	73 42                	jae    c010ace6 <memmove+0x64>
c010aca4:	8b 45 d0             	mov    -0x30(%ebp),%eax
c010aca7:	89 45 e8             	mov    %eax,-0x18(%ebp)
c010acaa:	8b 45 cc             	mov    -0x34(%ebp),%eax
c010acad:	89 45 e4             	mov    %eax,-0x1c(%ebp)
c010acb0:	8b 45 c8             	mov    -0x38(%ebp),%eax
c010acb3:	89 45 e0             	mov    %eax,-0x20(%ebp)
        "andl $3, %%ecx;"
        "jz 1f;"
        "rep; movsb;"
        "1:"
        : "=&c" (d0), "=&D" (d1), "=&S" (d2)
        : "0" (n / 4), "g" (n), "1" (dst), "2" (src)
c010acb6:	8b 45 e0             	mov    -0x20(%ebp),%eax
c010acb9:	89 c1                	mov    %eax,%ecx
c010acbb:	c1 e9 02             	shr    $0x2,%ecx
#ifndef __HAVE_ARCH_MEMCPY
#define __HAVE_ARCH_MEMCPY
static inline void *
__memcpy(void *dst, const void *src, size_t n) {
    int d0, d1, d2;
    asm volatile (
c010acbe:	8b 55 e8             	mov    -0x18(%ebp),%edx
c010acc1:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c010acc4:	89 d7                	mov    %edx,%edi
c010acc6:	89 c6                	mov    %eax,%esi
c010acc8:	f3 a5                	rep movsl %ds:(%esi),%es:(%edi)
c010acca:	8b 4d e0             	mov    -0x20(%ebp),%ecx
c010accd:	83 e1 03             	and    $0x3,%ecx
c010acd0:	74 02                	je     c010acd4 <memmove+0x52>
c010acd2:	f3 a4                	rep movsb %ds:(%esi),%es:(%edi)
c010acd4:	89 f0                	mov    %esi,%eax
c010acd6:	89 fa                	mov    %edi,%edx
c010acd8:	89 4d f4             	mov    %ecx,-0xc(%ebp)
c010acdb:	89 55 f0             	mov    %edx,-0x10(%ebp)
c010acde:	89 45 ec             	mov    %eax,-0x14(%ebp)
        "rep; movsb;"
        "1:"
        : "=&c" (d0), "=&D" (d1), "=&S" (d2)
        : "0" (n / 4), "g" (n), "1" (dst), "2" (src)
        : "memory");
    return dst;
c010ace1:	8b 45 e8             	mov    -0x18(%ebp),%eax
c010ace4:	eb 2f                	jmp    c010ad15 <memmove+0x93>
    asm volatile (
        "std;"
        "rep; movsb;"
        "cld;"
        : "=&c" (d0), "=&S" (d1), "=&D" (d2)
        : "0" (n), "1" (n - 1 + src), "2" (n - 1 + dst)
c010ace6:	8b 45 c8             	mov    -0x38(%ebp),%eax
c010ace9:	83 e8 01             	sub    $0x1,%eax
c010acec:	89 c2                	mov    %eax,%edx
c010acee:	03 55 cc             	add    -0x34(%ebp),%edx
c010acf1:	8b 45 c8             	mov    -0x38(%ebp),%eax
c010acf4:	83 e8 01             	sub    $0x1,%eax
c010acf7:	03 45 d0             	add    -0x30(%ebp),%eax
__memmove(void *dst, const void *src, size_t n) {
    if (dst < src) {
        return __memcpy(dst, src, n);
    }
    int d0, d1, d2;
    asm volatile (
c010acfa:	8b 4d c8             	mov    -0x38(%ebp),%ecx
c010acfd:	89 d6                	mov    %edx,%esi
c010acff:	89 c7                	mov    %eax,%edi
c010ad01:	fd                   	std    
c010ad02:	f3 a4                	rep movsb %ds:(%esi),%es:(%edi)
c010ad04:	fc                   	cld    
c010ad05:	89 f8                	mov    %edi,%eax
c010ad07:	89 f2                	mov    %esi,%edx
c010ad09:	89 4d dc             	mov    %ecx,-0x24(%ebp)
c010ad0c:	89 55 d8             	mov    %edx,-0x28(%ebp)
c010ad0f:	89 45 d4             	mov    %eax,-0x2c(%ebp)
        "rep; movsb;"
        "cld;"
        : "=&c" (d0), "=&S" (d1), "=&D" (d2)
        : "0" (n), "1" (n - 1 + src), "2" (n - 1 + dst)
        : "memory");
    return dst;
c010ad12:	8b 45 d0             	mov    -0x30(%ebp),%eax
            *d ++ = *s ++;
        }
    }
    return dst;
#endif /* __HAVE_ARCH_MEMMOVE */
}
c010ad15:	83 c4 30             	add    $0x30,%esp
c010ad18:	5e                   	pop    %esi
c010ad19:	5f                   	pop    %edi
c010ad1a:	5d                   	pop    %ebp
c010ad1b:	c3                   	ret    

c010ad1c <memcpy>:
 * it always copies exactly @n bytes. To avoid overflows, the size of arrays pointed
 * by both @src and @dst, should be at least @n bytes, and should not overlap
 * (for overlapping memory area, memmove is a safer approach).
 * */
void *
memcpy(void *dst, const void *src, size_t n) {
c010ad1c:	55                   	push   %ebp
c010ad1d:	89 e5                	mov    %esp,%ebp
c010ad1f:	57                   	push   %edi
c010ad20:	56                   	push   %esi
c010ad21:	83 ec 20             	sub    $0x20,%esp
c010ad24:	8b 45 08             	mov    0x8(%ebp),%eax
c010ad27:	89 45 e8             	mov    %eax,-0x18(%ebp)
c010ad2a:	8b 45 0c             	mov    0xc(%ebp),%eax
c010ad2d:	89 45 e4             	mov    %eax,-0x1c(%ebp)
c010ad30:	8b 45 10             	mov    0x10(%ebp),%eax
c010ad33:	89 45 e0             	mov    %eax,-0x20(%ebp)
        "andl $3, %%ecx;"
        "jz 1f;"
        "rep; movsb;"
        "1:"
        : "=&c" (d0), "=&D" (d1), "=&S" (d2)
        : "0" (n / 4), "g" (n), "1" (dst), "2" (src)
c010ad36:	8b 45 e0             	mov    -0x20(%ebp),%eax
c010ad39:	89 c1                	mov    %eax,%ecx
c010ad3b:	c1 e9 02             	shr    $0x2,%ecx
#ifndef __HAVE_ARCH_MEMCPY
#define __HAVE_ARCH_MEMCPY
static inline void *
__memcpy(void *dst, const void *src, size_t n) {
    int d0, d1, d2;
    asm volatile (
c010ad3e:	8b 55 e8             	mov    -0x18(%ebp),%edx
c010ad41:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c010ad44:	89 d7                	mov    %edx,%edi
c010ad46:	89 c6                	mov    %eax,%esi
c010ad48:	f3 a5                	rep movsl %ds:(%esi),%es:(%edi)
c010ad4a:	8b 4d e0             	mov    -0x20(%ebp),%ecx
c010ad4d:	83 e1 03             	and    $0x3,%ecx
c010ad50:	74 02                	je     c010ad54 <memcpy+0x38>
c010ad52:	f3 a4                	rep movsb %ds:(%esi),%es:(%edi)
c010ad54:	89 f0                	mov    %esi,%eax
c010ad56:	89 fa                	mov    %edi,%edx
c010ad58:	89 4d f4             	mov    %ecx,-0xc(%ebp)
c010ad5b:	89 55 f0             	mov    %edx,-0x10(%ebp)
c010ad5e:	89 45 ec             	mov    %eax,-0x14(%ebp)
        "rep; movsb;"
        "1:"
        : "=&c" (d0), "=&D" (d1), "=&S" (d2)
        : "0" (n / 4), "g" (n), "1" (dst), "2" (src)
        : "memory");
    return dst;
c010ad61:	8b 45 e8             	mov    -0x18(%ebp),%eax
    while (n -- > 0) {
        *d ++ = *s ++;
    }
    return dst;
#endif /* __HAVE_ARCH_MEMCPY */
}
c010ad64:	83 c4 20             	add    $0x20,%esp
c010ad67:	5e                   	pop    %esi
c010ad68:	5f                   	pop    %edi
c010ad69:	5d                   	pop    %ebp
c010ad6a:	c3                   	ret    

c010ad6b <memcmp>:
 *   match in both memory blocks has a greater value in @v1 than in @v2
 *   as if evaluated as unsigned char values;
 * - And a value less than zero indicates the opposite.
 * */
int
memcmp(const void *v1, const void *v2, size_t n) {
c010ad6b:	55                   	push   %ebp
c010ad6c:	89 e5                	mov    %esp,%ebp
c010ad6e:	83 ec 10             	sub    $0x10,%esp
    const char *s1 = (const char *)v1;
c010ad71:	8b 45 08             	mov    0x8(%ebp),%eax
c010ad74:	89 45 f8             	mov    %eax,-0x8(%ebp)
    const char *s2 = (const char *)v2;
c010ad77:	8b 45 0c             	mov    0xc(%ebp),%eax
c010ad7a:	89 45 fc             	mov    %eax,-0x4(%ebp)
    while (n -- > 0) {
c010ad7d:	eb 32                	jmp    c010adb1 <memcmp+0x46>
        if (*s1 != *s2) {
c010ad7f:	8b 45 f8             	mov    -0x8(%ebp),%eax
c010ad82:	0f b6 10             	movzbl (%eax),%edx
c010ad85:	8b 45 fc             	mov    -0x4(%ebp),%eax
c010ad88:	0f b6 00             	movzbl (%eax),%eax
c010ad8b:	38 c2                	cmp    %al,%dl
c010ad8d:	74 1a                	je     c010ada9 <memcmp+0x3e>
            return (int)((unsigned char)*s1 - (unsigned char)*s2);
c010ad8f:	8b 45 f8             	mov    -0x8(%ebp),%eax
c010ad92:	0f b6 00             	movzbl (%eax),%eax
c010ad95:	0f b6 d0             	movzbl %al,%edx
c010ad98:	8b 45 fc             	mov    -0x4(%ebp),%eax
c010ad9b:	0f b6 00             	movzbl (%eax),%eax
c010ad9e:	0f b6 c0             	movzbl %al,%eax
c010ada1:	89 d1                	mov    %edx,%ecx
c010ada3:	29 c1                	sub    %eax,%ecx
c010ada5:	89 c8                	mov    %ecx,%eax
c010ada7:	eb 1c                	jmp    c010adc5 <memcmp+0x5a>
        }
        s1 ++, s2 ++;
c010ada9:	83 45 f8 01          	addl   $0x1,-0x8(%ebp)
c010adad:	83 45 fc 01          	addl   $0x1,-0x4(%ebp)
 * */
int
memcmp(const void *v1, const void *v2, size_t n) {
    const char *s1 = (const char *)v1;
    const char *s2 = (const char *)v2;
    while (n -- > 0) {
c010adb1:	83 7d 10 00          	cmpl   $0x0,0x10(%ebp)
c010adb5:	0f 95 c0             	setne  %al
c010adb8:	83 6d 10 01          	subl   $0x1,0x10(%ebp)
c010adbc:	84 c0                	test   %al,%al
c010adbe:	75 bf                	jne    c010ad7f <memcmp+0x14>
        if (*s1 != *s2) {
            return (int)((unsigned char)*s1 - (unsigned char)*s2);
        }
        s1 ++, s2 ++;
    }
    return 0;
c010adc0:	b8 00 00 00 00       	mov    $0x0,%eax
}
c010adc5:	c9                   	leave  
c010adc6:	c3                   	ret    
